@@ -182,9 +182,12 @@ export async function warnIfCronSchedulerDisabled(opts: GatewayRpcOpts) {
|
182 | 182 | if (res?.enabled === true) { |
183 | 183 | return; |
184 | 184 | } |
185 | | -const store = typeof res?.sqlitePath === "string" ? res.sqlitePath |
186 | | - : typeof res?.storePath === "string" ? res.storePath |
187 | | - : ""; |
| 185 | +const store = |
| 186 | +typeof res?.sqlitePath === "string" |
| 187 | + ? res.sqlitePath |
| 188 | + : typeof res?.storePath === "string" |
| 189 | + ? res.storePath |
| 190 | + : ""; |
188 | 191 | defaultRuntime.error( |
189 | 192 | [ |
190 | 193 | "warning: cron scheduler is disabled in the Gateway; jobs are saved but will not run automatically.", |
@@ -377,17 +380,6 @@ const formatSchedule = (schedule: CronSchedule | undefined) => {
|
377 | 380 | return `${base} (stagger ${formatDurationHuman(staggerMs)})`; |
378 | 381 | }; |
379 | 382 | |
380 | | -const formatStatus = (job: CronJob) => { |
381 | | -if (!job.enabled) { |
382 | | -return "disabled"; |
383 | | -} |
384 | | -const state = job.state ?? {}; |
385 | | -if (state.runningAtMs) { |
386 | | -return "running"; |
387 | | -} |
388 | | -return state.lastStatus ?? "idle"; |
389 | | -}; |
390 | | - |
391 | 383 | export function coerceCronDeliveryPreviews(value: unknown): Map<string, CronDeliveryPreview> { |
392 | 384 | const previews = |
393 | 385 | value && typeof value === "object" |
@@ -450,7 +442,7 @@ export function printCronList(
|
450 | 442 | CRON_NEXT_PAD, |
451 | 443 | ); |
452 | 444 | const lastLabel = pad(formatRelative(state.lastRunAtMs, now), CRON_LAST_PAD); |
453 | | -const statusRaw = formatStatus(job); |
| 445 | +const statusRaw = computeStatus(job); |
454 | 446 | const statusLabel = pad(statusRaw, CRON_STATUS_PAD); |
455 | 447 | const targetLabel = pad(job.sessionTarget ?? "-", CRON_TARGET_PAD); |
456 | 448 | const deliveryPreview = opts?.deliveryPreviews?.get(job.id); |
@@ -528,6 +520,6 @@ export function printCronShow(
|
528 | 520 | runtime.log(`delivery: ${preview.label} (${preview.detail})`); |
529 | 521 | runtime.log(`next: ${formatRelative(job.state.nextRunAtMs, Date.now())}`); |
530 | 522 | runtime.log(`last: ${formatRelative(job.state.lastRunAtMs, Date.now())}`); |
531 | | -runtime.log(`status: ${formatStatus(job)}`); |
| 523 | +runtime.log(`status: ${computeStatus(job)}`); |
532 | 524 | runtime.log(`diagnostic: ${job.state.lastDiagnosticSummary ?? "-"}`); |
533 | 525 | } |