fix(cron): prevent one-shot at jobs from re-firing on restart after skip/error (#13845) (#13878)

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
大猫子
2026-02-12 13:33:15 +08:00
committed by GitHub
parent b0dfb83952
commit a88ea42ec7
3 changed files with 98 additions and 1 deletions

View File

@@ -369,7 +369,10 @@ export async function runMissedJobs(state: CronServiceState) {
return false;
}
const next = j.state.nextRunAtMs;
if (j.schedule.kind === "at" && j.state.lastStatus === "ok") {
if (j.schedule.kind === "at" && j.state.lastStatus) {
// Any terminal status (ok, error, skipped) means the job already
// ran at least once. Don't re-fire it on restart — applyJobResult
// disables one-shot jobs, but guard here defensively (#13845).
return false;
}
return typeof next === "number" && now >= next;