From 1b0f90664029e216641bb6b0341624b1d3d2d49e Mon Sep 17 00:00:00 2001 From: fish Date: Sat, 25 Jul 2026 21:34:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E5=90=8C=E6=AD=A5=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=97=B6=E5=89=8D=E7=AB=AF=E6=98=BE=E7=A4=BA=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=8F=90=E7=A4=BA=EF=BC=8C=E4=B8=8D=E5=86=8D=E5=8D=A1?= =?UTF-8?q?=E4=BD=8F=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- ft-app/app/collector.py | 7 +++++-- ft-app/app/templates/admin.html | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ft-app/app/collector.py b/ft-app/app/collector.py index 2540695..05f320f 100644 --- a/ft-app/app/collector.py +++ b/ft-app/app/collector.py @@ -5,7 +5,7 @@ from app.database import SessionLocal from app.models import DailyBar, Contract from app.engine.lock_strategy import compute_amp_5d -_progress = {"running": False, "label": "", "done": 0, "total": 0, "result": 0, "finished": False} +_progress = {"running": False, "label": "", "done": 0, "total": 0, "result": 0, "finished": False, "error": ""} _lock = threading.Lock() @@ -18,11 +18,14 @@ def _start_bg(target, label): with _lock: if _progress["running"]: return False - _progress.update(running=True, finished=False, label=label, done=0, total=0) + _progress.update(running=True, finished=False, label=label, done=0, total=0, error="") def _run(): try: target() + except Exception as e: + with _lock: + _progress["error"] = str(e) finally: with _lock: _progress["running"] = False diff --git a/ft-app/app/templates/admin.html b/ft-app/app/templates/admin.html index 660c920..b5700ed 100644 --- a/ft-app/app/templates/admin.html +++ b/ft-app/app/templates/admin.html @@ -192,6 +192,12 @@