fix(sources): 快照开始前收尾本站遗留的运行中记录;v0.3.39
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
This commit is contained in:
1 parent
5c74666148
commit
8ff1817845
14 files changed
+51
-11
No files matched your search
@@ -216,6 +216,18 @@ export async function snapshotSite(
|
||||
if (input.kind === "periodic" || input.kind === "manual") {
|
||||
maxPages = Math.min(maxPages, (await rt.siteAccess(site.key)).snapshotMaxPages);
|
||||
}
|
||||
// 进程被杀或旧版本卡死留下的「运行中」记录:超过两倍截止时间就按中断收尾(清理任务不删运行中的行)
|
||||
await db
|
||||
.updateTable("site_snapshot")
|
||||
.set({
|
||||
status: "failed",
|
||||
error: jsonb({ kind: "internal", message: "上次快照中断,没有收尾" }),
|
||||
finished_at: rt.now(),
|
||||
})
|
||||
.where("site_id", "=", site.id)
|
||||
.where("status", "=", "running")
|
||||
.where("started_at", "<", new Date(rt.now().getTime() - 2 * (opts.deadlineMs ?? SNAPSHOT_DEADLINE_MS)))
|
||||
.execute();
|
||||
const snap = await db
|
||||
.insertInto("site_snapshot")
|
||||
.values({
|
||||
|
||||
Reference in new issue
Block a user