fix(server): gracefully handle unknown jobs (#12870)

This commit is contained in:
Jason Rasmussen 2024-09-23 13:22:36 -04:00 committed by GitHub
parent 9f8a7e0bea
commit e748945b4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);