refactor: unify data preparations and research input snapshots
Deploy production / deploy (push) Successful in 53s

This commit is contained in:
yuxuanhui
2026-09-12 01:24:02 +08:00
parent 849f86fef7
commit 394438e753
82 changed files with 4146 additions and 2076 deletions
+9 -1
View File
@@ -263,9 +263,17 @@ class Business:
return {"ok": True, "job_id": job_id}
async def retry_job(self, job_id):
job = await self.db.scalar(select(Job).where(Job.id == job_id).with_for_update())
# Match create_job's lock order so retry and a fresh scheduled run share one scope owner.
await self.db.scalar(select(Account).where(Account.id == 1).with_for_update())
job = await self.db.scalar(select(Job).where(Job.id == job_id).with_for_update()
.execution_options(populate_existing=True))
if not job:
raise HTTPException(404, "任务不存在")
if job.kind == "catalog_full_sync":
active = await self.db.scalars(select(Job).where(Job.kind == job.kind, Job.status.in_(ACTIVE)))
for existing in active:
if existing.payload == job.payload and (existing.id != job.id or job.status in ("queued", "running")):
return JobOutput.model_validate(existing).model_dump(mode="json")
if job.status not in (
"failed",
"cancelled",