fix(cron): retry next-second schedule compute on undefined

This commit is contained in:
Peter Steinberger
2026-02-17 23:48:08 +01:00
parent c26cf6aa83
commit dd4eb8bf63

View File

@@ -138,7 +138,12 @@ export function computeJobNextRunAtMs(job: CronJob, nowMs: number): number | und
: null;
return atMs !== null ? atMs : undefined;
}
return computeStaggeredCronNextRunAtMs(job, nowMs);
const next = computeStaggeredCronNextRunAtMs(job, nowMs);
if (next === undefined && job.schedule.kind === "cron") {
const nextSecondMs = Math.floor(nowMs / 1000) * 1000 + 1000;
return computeStaggeredCronNextRunAtMs(job, nextSecondMs);
}
return next;
}
/** Maximum consecutive schedule errors before auto-disabling a job. */