From dd4eb8bf6320faeebf2c9b3486f1f43050c5a507 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 17 Feb 2026 23:48:08 +0100 Subject: [PATCH] fix(cron): retry next-second schedule compute on undefined --- src/cron/service/jobs.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cron/service/jobs.ts b/src/cron/service/jobs.ts index 302ccefa25..e547ed9de4 100644 --- a/src/cron/service/jobs.ts +++ b/src/cron/service/jobs.ts @@ -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. */