Fix stuck 'processing' tasks after restart
Docker Build and Push / check-secrets (push) Failing after 4s
Docker Build and Push / build-and-push (cpu, latest) (push) Has been skipped
Docker Build and Push / build-and-push (cuda, 11.8) (push) Has been skipped
Docker Build and Push / build-and-push (cuda, 12.6) (push) Has been skipped
Docker Build and Push / build-and-push (cuda, 12.8) (push) Has been skipped
Docker Build and Push / build-and-push (directml, latest) (push) Has been skipped
Build Windows CPU / build (push) Has been cancelled
Build Windows CUDA 11.8 / build (push) Has been cancelled
Build Windows CUDA 12.6 / build (push) Has been cancelled
Build Windows CUDA 12.8 / build (push) Has been cancelled
Build Windows DirectML / build (push) Has been cancelled

On startup, tasks in downloading/processing state are interrupted (not
completed). Previously they were re-queued, causing the same task to be
processed multiple times after each restart.

Now: interrupted tasks are immediately marked as error with message
'服务重启,任务中断'. Only 'pending' tasks are re-queued.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
liuchen
2026-06-27 15:10:07 +08:00
co-authored by Claude Haiku 4.5
parent 4d2fee2b1b
commit 27b4a2c1bf
+6 -1
View File
@@ -331,9 +331,14 @@ def _load_tasks_from_db():
"completed_at": r.get("completed_at"),
"logs": [],
}
# 重启时 downloading/processing 说明上次处理被中断,标为 error
if task["status"] in ("downloading", "processing"):
task["status"] = "error"
task["error"] = "服务重启,任务中断"
_save_task_to_db(task)
with task_lock:
tasks[task["id"]] = task
if task["status"] in ("pending", "downloading", "processing"):
if task["status"] == "pending":
task_queue.put(task["id"])
conn.close()
except Exception as e: