mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 14:34:32 +00:00
fix (cron): skip startup replay for interrupted running jobs
This commit is contained in:
@@ -22,6 +22,7 @@ export async function start(state: CronServiceState) {
|
||||
}
|
||||
await ensureLoaded(state, { skipRecompute: true });
|
||||
const jobs = state.store?.jobs ?? [];
|
||||
const startupInterruptedJobIds = new Set<string>();
|
||||
for (const job of jobs) {
|
||||
if (typeof job.state.runningAtMs === "number") {
|
||||
state.deps.log.warn(
|
||||
@@ -29,9 +30,10 @@ export async function start(state: CronServiceState) {
|
||||
"cron: clearing stale running marker on startup",
|
||||
);
|
||||
job.state.runningAtMs = undefined;
|
||||
startupInterruptedJobIds.add(job.id);
|
||||
}
|
||||
}
|
||||
await runMissedJobs(state);
|
||||
await runMissedJobs(state, { skipJobIds: startupInterruptedJobIds });
|
||||
recomputeNextRuns(state);
|
||||
await persist(state);
|
||||
armTimer(state);
|
||||
|
||||
Reference in New Issue
Block a user