auto-sync: 2026-05-24 19:56:52
This commit is contained in:
@@ -549,6 +549,7 @@ class Dispatcher:
|
||||
def _mail_auto_working(self, task_id: str, db_path: Path) -> bool:
|
||||
"""Mail 任务:系统自动标 working(spawn 前)
|
||||
|
||||
Mail 不需要 claimed 中间态,直接 pending → working。
|
||||
Returns:
|
||||
True=标成功, False=标失败(需中止 spawn)
|
||||
"""
|
||||
@@ -557,16 +558,19 @@ class Dispatcher:
|
||||
try:
|
||||
conn.execute("BEGIN IMMEDIATE")
|
||||
row = conn.execute("SELECT status FROM tasks WHERE id=?", (task_id,)).fetchone()
|
||||
if not row or row["status"] != "claimed":
|
||||
logger.warning("Mail %s: cannot mark working (status=%s, expected claimed)",
|
||||
task_id, row["status"] if row else "None")
|
||||
if not row:
|
||||
logger.warning("Mail %s: cannot mark working (task not found)", task_id)
|
||||
return False
|
||||
if row["status"] not in ("pending", "claimed"):
|
||||
logger.warning("Mail %s: cannot mark working (status=%s, expected pending/claimed)",
|
||||
task_id, row["status"])
|
||||
return False
|
||||
conn.execute(
|
||||
"UPDATE tasks SET status='working', updated_at=datetime('now') WHERE id=?",
|
||||
(task_id,),
|
||||
)
|
||||
conn.commit()
|
||||
logger.info("Mail %s: auto-marked working (system)", task_id)
|
||||
logger.info("Mail %s: auto-marked working (system, was %s)", task_id, row["status"])
|
||||
return True
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
Reference in New Issue
Block a user