mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 12:41:23 +00:00
fix(cron): prevent list/status from silently skipping recurring jobs (openclaw#16201) thanks @zerone0x
Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: zerone0x <39543393+zerone0x@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
isJobDue,
|
||||
nextWakeAtMs,
|
||||
recomputeNextRuns,
|
||||
recomputeNextRunsForMaintenance,
|
||||
} from "./jobs.js";
|
||||
import { locked } from "./locked.js";
|
||||
import { ensureLoaded, persist, warnIfDisabled } from "./store.js";
|
||||
@@ -53,7 +54,9 @@ export async function status(state: CronServiceState) {
|
||||
return await locked(state, async () => {
|
||||
await ensureLoaded(state, { skipRecompute: true });
|
||||
if (state.store) {
|
||||
const changed = recomputeNextRuns(state);
|
||||
// Use the maintenance-only version so that read-only operations never
|
||||
// advance a past-due nextRunAtMs without executing the job (#16156).
|
||||
const changed = recomputeNextRunsForMaintenance(state);
|
||||
if (changed) {
|
||||
await persist(state);
|
||||
}
|
||||
@@ -71,7 +74,9 @@ export async function list(state: CronServiceState, opts?: { includeDisabled?: b
|
||||
return await locked(state, async () => {
|
||||
await ensureLoaded(state, { skipRecompute: true });
|
||||
if (state.store) {
|
||||
const changed = recomputeNextRuns(state);
|
||||
// Use the maintenance-only version so that read-only operations never
|
||||
// advance a past-due nextRunAtMs without executing the job (#16156).
|
||||
const changed = recomputeNextRunsForMaintenance(state);
|
||||
if (changed) {
|
||||
await persist(state);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user