Skip to content

Commit

Permalink
fix(server): gracefully handle unknown jobs (immich-app#12870)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrasm91 authored Sep 23, 2024
1 parent 9f8a7e0 commit e748945
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/src/services/job.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,16 @@ export class JobService {
this.jobRepository.addHandler(queueName, concurrency, async (item: JobItem): Promise<void> => {
const { name, data } = item;

const handler = jobHandlers[name];
if (!handler) {
this.logger.warn(`Skipping unknown job: "${name}"`);
return;
}

const queueMetric = `immich.queues.${snakeCase(queueName)}.active`;
this.metricRepository.jobs.addToGauge(queueMetric, 1);

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

0 comments on commit e748945

Please sign in to comment.