B6 fix: error事件只在重试耗尽时推送

重试中也推error会让前端FatalErrorBanner误报生成失败,
应只在exhausted(彻底失败)时推error事件。

import OK
This commit is contained in:
yangqianqian
2026-06-16 12:47:06 +08:00
parent 1b488752e6
commit ffc213fb3d

View File

@@ -152,8 +152,9 @@ def run_generation_pipeline(self, task_id: int) -> dict:
db.commit() db.commit()
except Exception: except Exception:
pass pass
_push_event_sync(task_id, workspace_id, "error", {"code": 50001, "message": str(exc)}, seq + 1)
if exhausted: if exhausted:
# 彻底失败才推 error(前端弹 FatalErrorBanner);重试中不推,避免误报"生成失败"。
_push_event_sync(task_id, workspace_id, "error", {"code": 50001, "message": str(exc)}, seq + 1)
return {"task_id": task_id, "status": "failed", "error": str(exc)} return {"task_id": task_id, "status": "failed", "error": str(exc)}
raise self.retry(exc=exc) raise self.retry(exc=exc)
finally: finally: