fix: schedule nextWakeAtMs for isolated sessionTarget cron jobs (#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
Pierre
2026-02-28 08:48:31 -08:00
committed by GitHub
parent 139271ad5a
commit e1c8094ad0
4 changed files with 88 additions and 16 deletions

View File

@@ -250,8 +250,12 @@ export function armTimer(state: CronServiceState) {
const jobCount = state.store?.jobs.length ?? 0;
const enabledCount = state.store?.jobs.filter((j) => j.enabled).length ?? 0;
const withNextRun =
state.store?.jobs.filter((j) => j.enabled && typeof j.state.nextRunAtMs === "number")
.length ?? 0;
state.store?.jobs.filter(
(j) =>
j.enabled &&
typeof j.state.nextRunAtMs === "number" &&
Number.isFinite(j.state.nextRunAtMs),
).length ?? 0;
state.deps.log.debug(
{ jobCount, enabledCount, withNextRun },
"cron: armTimer skipped - no jobs with nextRunAtMs",
@@ -476,7 +480,7 @@ function isRunnableJob(params: {
return false;
}
const next = job.state.nextRunAtMs;
return typeof next === "number" && nowMs >= next;
return typeof next === "number" && Number.isFinite(next) && nowMs >= next;
}
function collectRunnableJobs(