mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 06:21:26 +00:00
fix: prevent cron jobs from skipping execution when nextRunAtMs advances (#14068)
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
computeJobNextRunAtMs,
|
||||
nextWakeAtMs,
|
||||
recomputeNextRuns,
|
||||
recomputeNextRunsForMaintenance,
|
||||
resolveJobPayloadTextForMain,
|
||||
} from "./jobs.js";
|
||||
import { locked } from "./locked.js";
|
||||
@@ -187,7 +188,10 @@ export async function onTimer(state: CronServiceState) {
|
||||
const due = findDueJobs(state);
|
||||
|
||||
if (due.length === 0) {
|
||||
const changed = recomputeNextRuns(state);
|
||||
// Use maintenance-only recompute to avoid advancing past-due nextRunAtMs
|
||||
// values without execution. This prevents jobs from being silently skipped
|
||||
// when the timer wakes up but findDueJobs returns empty (see #13992).
|
||||
const changed = recomputeNextRunsForMaintenance(state);
|
||||
if (changed) {
|
||||
await persist(state);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user