mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 16:34:59 +00:00
fix(cron): treat missing enabled as true in update() (openclaw#15477) thanks @eternauta1337
Verified: - pnpm exec vitest src/cron/service.issue-regressions.test.ts Co-authored-by: eternauta1337 <550409+eternauta1337@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
a7b6555195
commit
9a344da298
@@ -84,7 +84,7 @@ export async function list(state: CronServiceState, opts?: { includeDisabled?: b
|
||||
}
|
||||
}
|
||||
const includeDisabled = opts?.includeDisabled === true;
|
||||
const jobs = (state.store?.jobs ?? []).filter((j) => includeDisabled || j.enabled);
|
||||
const jobs = (state.store?.jobs ?? []).filter((j) => includeDisabled || j.enabled !== false);
|
||||
return jobs.toSorted((a, b) => (a.state.nextRunAtMs ?? 0) - (b.state.nextRunAtMs ?? 0));
|
||||
});
|
||||
}
|
||||
@@ -151,7 +151,7 @@ export async function update(state: CronServiceState, id: string, patch: CronJob
|
||||
|
||||
job.updatedAtMs = now;
|
||||
if (scheduleChanged || enabledChanged) {
|
||||
if (job.enabled) {
|
||||
if (job.enabled !== false) {
|
||||
job.state.nextRunAtMs = computeJobNextRunAtMs(job, now);
|
||||
} else {
|
||||
job.state.nextRunAtMs = undefined;
|
||||
|
||||
Reference in New Issue
Block a user