mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 11:01:24 +00:00
chore(cron): simplify enabled checks for lint
This commit is contained in:
@@ -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 !== false);
|
||||
const jobs = (state.store?.jobs ?? []).filter((j) => includeDisabled || j.enabled);
|
||||
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 !== false) {
|
||||
if (job.enabled) {
|
||||
job.state.nextRunAtMs = computeJobNextRunAtMs(job, now);
|
||||
} else {
|
||||
job.state.nextRunAtMs = undefined;
|
||||
|
||||
Reference in New Issue
Block a user