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

View File

@ -621,7 +621,7 @@ export class CronJobDetail extends LitElement {
super.connectedCallback();
if (this.job && this.client) {
this.currentJobId = this.job.id;
this.loadRuns();
void this.loadRuns();
}
}
@ -631,7 +631,7 @@ export class CronJobDetail extends LitElement {
this.expandedRuns.clear();
this.isEditingPayload = 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 isExpanded = this.expandedRuns.has(runKey);
const output = run.outputText || run.summary || "";

View File

@ -124,7 +124,7 @@ export class CronQueue {
username: url.username || undefined,
};
} 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, {

View File

@ -7,13 +7,12 @@
import { CronQueue } from "./queue.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 {
applyJobPatch,
computeJobNextRunAtMs,
createJob,
findJobOrThrow,
resolveJobPayloadTextForMain,
} from "../service/jobs.js";
import type { HeartbeatRunResult } from "../../infra/heartbeat-wake.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 {
appendCronRunLog,
readCronRunLogEntries,
resolveCronRunLogPath,
type CronRunLogEntry,
} from "../run-log.js";
import { readCronRunLogEntries, resolveCronRunLogPath, type CronRunLogEntry } from "../run-log.js";
export type BullMQCronServiceDeps = CronServiceDeps & {
redisUrl?: string;
@ -357,7 +351,6 @@ export class BullMQCronService {
const shouldDelete =
job.schedule.kind === "at" && execResult.status === "ok" && job.deleteAfterRun === true;
let deleted = false;
if (!shouldDelete) {
if (job.schedule.kind === "at" && execResult.status === "ok") {
@ -387,7 +380,6 @@ export class BullMQCronService {
if (shouldDelete && this.state.store) {
this.state.store.jobs = this.state.store.jobs.filter((j) => j.id !== job.id);
deleted = true;
if (this.state.queue) {
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 {
isHeartbeatOnlyResponse,
pickLastNonEmptyTextFromPayloads,
pickSummaryFromOutput,
pickSummaryFromPayloads,
collectFullOutput,

View File

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

View File

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