diff --git a/src/cron/service/jobs.ts b/src/cron/service/jobs.ts index 132156a0c..169f23d5d 100644 --- a/src/cron/service/jobs.ts +++ b/src/cron/service/jobs.ts @@ -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); } }