auto-sync: 2026-05-24 19:56:52

This commit is contained in:
cfdaily
2026-05-24 19:56:52 +08:00
parent 9e268c795a
commit 836596efb7
+8 -4
View File
@@ -549,6 +549,7 @@ class Dispatcher:
def _mail_auto_working(self, task_id: str, db_path: Path) -> bool: def _mail_auto_working(self, task_id: str, db_path: Path) -> bool:
"""Mail 任务:系统自动标 workingspawn 前) """Mail 任务:系统自动标 workingspawn 前)
Mail 不需要 claimed 中间态,直接 pending → working。
Returns: Returns:
True=标成功, False=标失败(需中止 spawn True=标成功, False=标失败(需中止 spawn
""" """
@@ -557,16 +558,19 @@ class Dispatcher:
try: try:
conn.execute("BEGIN IMMEDIATE") conn.execute("BEGIN IMMEDIATE")
row = conn.execute("SELECT status FROM tasks WHERE id=?", (task_id,)).fetchone() row = conn.execute("SELECT status FROM tasks WHERE id=?", (task_id,)).fetchone()
if not row or row["status"] != "claimed": if not row:
logger.warning("Mail %s: cannot mark working (status=%s, expected claimed)", logger.warning("Mail %s: cannot mark working (task not found)", task_id)
task_id, row["status"] if row else "None") 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 return False
conn.execute( conn.execute(
"UPDATE tasks SET status='working', updated_at=datetime('now') WHERE id=?", "UPDATE tasks SET status='working', updated_at=datetime('now') WHERE id=?",
(task_id,), (task_id,),
) )
conn.commit() 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 return True
finally: finally:
conn.close() conn.close()