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 @@