fix: lint errors in BullMQ cron PR

This commit is contained in:
Jarvis 2026-01-28 17:26:58 +00:00
parent b7393502cc
commit 8163628f78
7 changed files with 17 additions and 27 deletions

View File

@ -130,7 +130,7 @@ export class CronApp extends LitElement {
await this.client.connect(); await this.client.connect();
this.connected = true; this.connected = true;
await this.refresh(); await this.refresh();
} catch (e) { } catch {
this.error = "Failed to connect to gateway"; this.error = "Failed to connect to gateway";
this.connected = false; this.connected = false;
} }
@ -171,7 +171,7 @@ export class CronApp extends LitElement {
} }
} catch { } catch {
// Fallback to full refresh // Fallback to full refresh
this.refresh(); void this.refresh();
} }
return; return;
} }
@ -202,32 +202,32 @@ export class CronApp extends LitElement {
this.selectedJobId = jobId || null; this.selectedJobId = jobId || null;
} }
private async handleRunJob(e: CustomEvent<{ id: string }>) { private handleRunJob = async (e: CustomEvent<{ id: string }>) => {
try { try {
await this.client.run(e.detail.id, "force"); await this.client.run(e.detail.id, "force");
} catch (err) { } catch (err) {
this.error = err instanceof Error ? err.message : "Failed to run job"; this.error = err instanceof Error ? err.message : "Failed to run job";
} }
} };
private async handleToggleJob(e: CustomEvent<{ id: string; enabled: boolean }>) { private handleToggleJob = async (e: CustomEvent<{ id: string; enabled: boolean }>) => {
try { try {
await this.client.update(e.detail.id, { enabled: e.detail.enabled }); await this.client.update(e.detail.id, { enabled: e.detail.enabled });
} catch (err) { } catch (err) {
this.error = err instanceof Error ? err.message : "Failed to update job"; this.error = err instanceof Error ? err.message : "Failed to update job";
} }
} };
private async handleDeleteJob(e: CustomEvent<{ id: string }>) { private handleDeleteJob = async (e: CustomEvent<{ id: string }>) => {
if (!confirm("Delete this job?")) return; if (!confirm("Delete this job?")) return;
try { try {
await this.client.remove(e.detail.id); await this.client.remove(e.detail.id);
} catch (err) { } catch (err) {
this.error = err instanceof Error ? err.message : "Failed to delete job"; this.error = err instanceof Error ? err.message : "Failed to delete job";
} }
} };
private async handleJobUpdated(e: CustomEvent<{ id: string }>) { private handleJobUpdated = async (e: CustomEvent<{ id: string }>) => {
// Refresh the specific job after an update // Refresh the specific job after an update
try { try {
const jobs = await this.client.list({ includeDisabled: true }); const jobs = await this.client.list({ includeDisabled: true });
@ -241,7 +241,7 @@ export class CronApp extends LitElement {
} catch (err) { } catch (err) {
this.error = err instanceof Error ? err.message : "Failed to refresh job"; this.error = err instanceof Error ? err.message : "Failed to refresh job";
} }
} };
render() { render() {
return html` return html`

View File

@ -621,7 +621,7 @@ export class CronJobDetail extends LitElement {
super.connectedCallback(); super.connectedCallback();
if (this.job && this.client) { if (this.job && this.client) {
this.currentJobId = this.job.id; this.currentJobId = this.job.id;
this.loadRuns(); void this.loadRuns();
} }
} }
@ -631,7 +631,7 @@ export class CronJobDetail extends LitElement {
this.expandedRuns.clear(); this.expandedRuns.clear();
this.isEditingPayload = false; this.isEditingPayload = false;
this.isEditingSchedule = false; this.isEditingSchedule = false;
this.loadRuns(); void this.loadRuns();
} }
} }
@ -1328,7 +1328,7 @@ export class CronJobDetail extends LitElement {
`; `;
} }
private renderLogEntry(run: CronRunEntry, index: number) { private renderLogEntry(run: CronRunEntry) {
const runKey = `${run.ts}`; const runKey = `${run.ts}`;
const isExpanded = this.expandedRuns.has(runKey); const isExpanded = this.expandedRuns.has(runKey);
const output = run.outputText || run.summary || ""; const output = run.outputText || run.summary || "";

View File

@ -124,7 +124,7 @@ export class CronQueue {
username: url.username || undefined, username: url.username || undefined,
}; };
} catch (err) { } catch (err) {
throw new Error(`Invalid Redis URL: ${redisUrl} (${err})`); throw new Error(`Invalid Redis URL: ${redisUrl} (${String(err)})`);
} }
this.queue = new Queue<CronJobData>(CRON_QUEUE_NAME, { this.queue = new Queue<CronJobData>(CRON_QUEUE_NAME, {

View File

@ -7,13 +7,12 @@
import { CronQueue } from "./queue.js"; import { CronQueue } from "./queue.js";
import type { CronJob, CronJobCreate, CronJobPatch, CronStoreFile } from "../types.js"; import type { CronJob, CronJobCreate, CronJobPatch, CronStoreFile } from "../types.js";
import type { CronEvent, CronServiceDeps, Logger } from "../service/state.js"; import type { CronEvent, CronServiceDeps } from "../service/state.js";
import { import {
applyJobPatch, applyJobPatch,
computeJobNextRunAtMs, computeJobNextRunAtMs,
createJob, createJob,
findJobOrThrow, findJobOrThrow,
resolveJobPayloadTextForMain,
} from "../service/jobs.js"; } from "../service/jobs.js";
import type { HeartbeatRunResult } from "../../infra/heartbeat-wake.js"; import type { HeartbeatRunResult } from "../../infra/heartbeat-wake.js";
import { locked } from "../service/locked.js"; import { locked } from "../service/locked.js";
@ -21,12 +20,7 @@ import { ensureLoaded, persist, warnIfDisabled } from "../service/store.js";
import type { CronQueueConfig } from "./queue.js"; import type { CronQueueConfig } from "./queue.js";
import { import { readCronRunLogEntries, resolveCronRunLogPath, type CronRunLogEntry } from "../run-log.js";
appendCronRunLog,
readCronRunLogEntries,
resolveCronRunLogPath,
type CronRunLogEntry,
} from "../run-log.js";
export type BullMQCronServiceDeps = CronServiceDeps & { export type BullMQCronServiceDeps = CronServiceDeps & {
redisUrl?: string; redisUrl?: string;
@ -357,7 +351,6 @@ export class BullMQCronService {
const shouldDelete = const shouldDelete =
job.schedule.kind === "at" && execResult.status === "ok" && job.deleteAfterRun === true; job.schedule.kind === "at" && execResult.status === "ok" && job.deleteAfterRun === true;
let deleted = false;
if (!shouldDelete) { if (!shouldDelete) {
if (job.schedule.kind === "at" && execResult.status === "ok") { if (job.schedule.kind === "at" && execResult.status === "ok") {
@ -387,7 +380,6 @@ export class BullMQCronService {
if (shouldDelete && this.state.store) { if (shouldDelete && this.state.store) {
this.state.store.jobs = this.state.store.jobs.filter((j) => j.id !== job.id); this.state.store.jobs = this.state.store.jobs.filter((j) => j.id !== job.id);
deleted = true;
if (this.state.queue) { if (this.state.queue) {
await this.state.queue.removeJobScheduler(job.id); await this.state.queue.removeJobScheduler(job.id);
} }

View File

@ -56,7 +56,6 @@ import type { CronJob } from "../types.js";
import { resolveDeliveryTarget } from "./delivery-target.js"; import { resolveDeliveryTarget } from "./delivery-target.js";
import { import {
isHeartbeatOnlyResponse, isHeartbeatOnlyResponse,
pickLastNonEmptyTextFromPayloads,
pickSummaryFromOutput, pickSummaryFromOutput,
pickSummaryFromPayloads, pickSummaryFromPayloads,
collectFullOutput, collectFullOutput,

View File

@ -1,5 +1,4 @@
import { normalizeCronJobCreate, normalizeCronJobPatch } from "../../cron/normalize.js"; import { normalizeCronJobCreate, normalizeCronJobPatch } from "../../cron/normalize.js";
import { readCronRunLogEntries, resolveCronRunLogPath } from "../../cron/run-log.js";
import type { CronJobCreate, CronJobPatch } from "../../cron/types.js"; import type { CronJobCreate, CronJobPatch } from "../../cron/types.js";
import { import {
ErrorCodes, ErrorCodes,

View File

@ -63,7 +63,7 @@ export function createGatewayReloadHandlers(params: {
resetDirectoryCache(); resetDirectoryCache();
if (plan.restartCron) { if (plan.restartCron) {
state.cronState.cron.stop(); void state.cronState.cron.stop();
nextState.cronState = buildGatewayCronService({ nextState.cronState = buildGatewayCronService({
cfg: nextConfig, cfg: nextConfig,
deps: params.deps, deps: params.deps,