#9393: fix(cron): avoid recomputeNextRuns on forceReload
stale
Cluster:
Cron Job Enhancements
Fixes cron timer never running jobs by skipping recomputeNextRuns on forceReload. When forceReload is used each tick, recomputeNextRuns advanced nextRunAtMs into the future, so dueCount stayed 0 forever.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR changes `src/cron/service/store.ts` to **skip `recomputeNextRuns(state)` when `ensureLoaded()` is called with `{ forceReload: true }`**. This aligns with the timer loop in `src/cron/service/timer.ts`, which force-reloads the cron store on every tick before calling `runDueJobs()`. The intent is to prevent `recomputeNextRuns` from continually advancing `job.state.nextRunAtMs` during repeated force reloads, which could otherwise keep jobs from ever becoming due.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- The change is a small, localized conditional around `recomputeNextRuns` that only affects the `{ forceReload: true }` path used by the timer tick; it prevents a confirmed starvation mode without changing job execution or persistence logic.
- No files require special attention
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#11108: fix(cron): prevent missed jobs from being skipped on timer recompute
by Bentlybro · 2026-02-07
87.1%
#12443: fix(cron): don't advance past-due jobs that haven't been executed
by rummangeminicode · 2026-02-09
86.6%
#10918: fix(cron): add tolerance for timer precision and skip due jobs in r...
by Cherwayway · 2026-02-07
84.2%
#12982: fix(cron): prevent status/list from advancing overdue job nextRunAtMs
by hclsys · 2026-02-10
84.0%
#12122: fix(cron): ensure timer callback fires for scheduled jobs
by divol89 · 2026-02-08
84.0%
#9684: fix: cron race condition - run due jobs before recomputing nextRunA...
by divol89 · 2026-02-05
83.7%
#12448: fix: prevent cron list/status from silently skipping due jobs
by Yida-Dev · 2026-02-09
83.6%
#11857: fix: recompute stale cron nextRunAtMs on gateway restart
by Yida-Dev · 2026-02-08
83.2%
#5428: fix(Cron): prevent one-shot loop on skip
by imshrishk · 2026-01-31
83.1%
#12303: fix(cron): correct nextRunAtMs calculation and prevent timer stall
by colddonkey · 2026-02-09
83.0%