mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
refactor(core): Better UX for maxStalledCount
queue mode error (#9075)
This commit is contained in:
parent
7bf0f900f1
commit
df56153f8b
|
@ -29,6 +29,7 @@ import { OrchestrationWorkerService } from '@/services/orchestration/worker/orch
|
||||||
import type { WorkerJobStatusSummary } from '@/services/orchestration/worker/types';
|
import type { WorkerJobStatusSummary } from '@/services/orchestration/worker/types';
|
||||||
import { ServiceUnavailableError } from '@/errors/response-errors/service-unavailable.error';
|
import { ServiceUnavailableError } from '@/errors/response-errors/service-unavailable.error';
|
||||||
import { BaseCommand } from './BaseCommand';
|
import { BaseCommand } from './BaseCommand';
|
||||||
|
import { MaxStalledCountError } from '@/errors/max-stalled-count.error';
|
||||||
|
|
||||||
export class Worker extends BaseCommand {
|
export class Worker extends BaseCommand {
|
||||||
static description = '\nStarts a n8n worker';
|
static description = '\nStarts a n8n worker';
|
||||||
|
@ -366,6 +367,11 @@ export class Worker extends BaseCommand {
|
||||||
process.exit(2);
|
process.exit(2);
|
||||||
} else {
|
} else {
|
||||||
this.logger.error('Error from queue: ', error);
|
this.logger.error('Error from queue: ', error);
|
||||||
|
|
||||||
|
if (error.message.includes('job stalled more than maxStalledCount')) {
|
||||||
|
throw new MaxStalledCountError(error);
|
||||||
|
}
|
||||||
|
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
13
packages/cli/src/errors/max-stalled-count.error.ts
Normal file
13
packages/cli/src/errors/max-stalled-count.error.ts
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import { ApplicationError } from 'n8n-workflow';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See https://github.com/OptimalBits/bull/blob/60fa88f08637f0325639988a3f054880a04ce402/docs/README.md?plain=1#L133
|
||||||
|
*/
|
||||||
|
export class MaxStalledCountError extends ApplicationError {
|
||||||
|
constructor(cause: Error) {
|
||||||
|
super('The execution has reached the maximum number of attempts and will no longer retry.', {
|
||||||
|
level: 'warning',
|
||||||
|
cause,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue