chore(cron): simplify enabled checks for lint

This commit is contained in:
Gustavo Madeira Santana
2026-02-15 10:19:50 -05:00
parent fa4c282f9e
commit 88caa4b50c
3 changed files with 14 additions and 21 deletions

View File

@@ -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;