mirror of
https://github.com/immich-app/immich.git
synced 2025-04-21 23:38:34 +02:00
fix(server): gracefully handle unknown jobs (#12870)
This commit is contained in:
parent
9f8a7e0bea
commit
e748945b4f
1 changed files with 6 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue