Skip to content

Commit e748945

Browse files
authored
fix(server): gracefully handle unknown jobs (#12870)
1 parent 9f8a7e0 commit e748945

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: server/src/services/job.service.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,16 @@ export class JobService {
186186
this.jobRepository.addHandler(queueName, concurrency, async (item: JobItem): Promise<void> => {
187187
const { name, data } = item;
188188

189+
const handler = jobHandlers[name];
190+
if (!handler) {
191+
this.logger.warn(`Skipping unknown job: "${name}"`);
192+
return;
193+
}
194+
189195
const queueMetric = `immich.queues.${snakeCase(queueName)}.active`;
190196
this.metricRepository.jobs.addToGauge(queueMetric, 1);
191197

192198
try {
193-
const handler = jobHandlers[name];
194199
const status = await handler(data);
195200
const jobMetric = `immich.jobs.${name.replaceAll('-', '_')}.${status}`;
196201
this.metricRepository.jobs.addToCounter(jobMetric, 1);

0 commit comments

Comments
 (0)