This commit is contained in:
Yuri Chukhlib 2026-01-29 20:56:13 +01:00 committed by GitHub
commit bfa23a9fda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -61,7 +61,13 @@ export function recomputeNextRuns(state: CronServiceState) {
);
job.state.runningAtMs = undefined;
}
job.state.nextRunAtMs = computeJobNextRunAtMs(job, now);
// For "every" jobs, anchor to lastRunAtMs to prevent schedule drift.
// For other job types (at, cron), use current time.
const baseTime =
job.schedule.kind === "every" && typeof job.state.lastRunAtMs === "number"
? job.state.lastRunAtMs
: now;
job.state.nextRunAtMs = computeJobNextRunAtMs(job, baseTime);
}
}