File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -385,8 +385,13 @@ function normalizeJobTickState(params: { state: CronServiceState; job: CronJob;
385385 const runningAt = job . state . runningAtMs ;
386386 if ( typeof runningAt === "number" ) {
387387 const jobTimeoutMs = resolveCronJobTimeoutMs ( job ) ;
388+ // Clamp to the fallback ceiling so absurdly large timeoutSeconds values
389+ // (which overflow setTimeout's 2^31-1 ms limit) don't leave stuck locks
390+ // blocking the job for days after a crash.
388391 const stuckThresholdMs =
389- typeof jobTimeoutMs === "number" ? jobTimeoutMs + STUCK_RUN_BUFFER_MS : STUCK_RUN_FALLBACK_MS ;
392+ typeof jobTimeoutMs === "number"
393+ ? Math . min ( jobTimeoutMs + STUCK_RUN_BUFFER_MS , STUCK_RUN_FALLBACK_MS )
394+ : STUCK_RUN_FALLBACK_MS ;
390395 if ( nowMs - runningAt > stuckThresholdMs ) {
391396 state . deps . log . warn (
392397 { jobId : job . id , runningAtMs : runningAt , stuckThresholdMs } ,
You can’t perform that action at this time.
0 commit comments