From 6f200ea77f2da9d3ec5b520090a578a4c2ce732f Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 4 Feb 2026 04:24:04 -0800 Subject: [PATCH] fix: force reload cron store --- src/cron/service/store.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/cron/service/store.ts b/src/cron/service/store.ts index b943d3300..659178d75 100644 --- a/src/cron/service/store.ts +++ b/src/cron/service/store.ts @@ -127,21 +127,13 @@ async function getFileMtimeMs(path: string): Promise { } export async function ensureLoaded(state: CronServiceState, opts?: { forceReload?: boolean }) { - // Fast path: store is already in memory. The timer path passes - // forceReload=true so that cross-service writes to the same store file - // are always picked up. Other callers (add, list, run, …) trust the - // in-memory copy to avoid a stat syscall on every operation. + // Fast path: store is already in memory. Other callers (add, list, run, …) + // trust the in-memory copy to avoid a stat syscall on every operation. if (state.store && !opts?.forceReload) { return; } - - if (opts?.forceReload && state.store) { - // Only pay for the stat when we're explicitly checking for external edits. - const mtime = await getFileMtimeMs(state.deps.storePath); - if (mtime !== null && state.storeFileMtimeMs !== null && mtime === state.storeFileMtimeMs) { - return; // File unchanged since our last load/persist. - } - } + // Force reload always re-reads the file to avoid missing cross-service + // edits on filesystems with coarse mtime resolution. const fileMtimeMs = await getFileMtimeMs(state.deps.storePath); const loaded = await loadCronStore(state.deps.storePath);