mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 04:04:06 -08:00
fix(core): Separate error handlers for main and worker (#11091)
This commit is contained in:
parent
722f4a8b77
commit
bb59cc71ac
|
@ -203,14 +203,6 @@ export class ScalingService {
|
||||||
// #region Listeners
|
// #region Listeners
|
||||||
|
|
||||||
private registerListeners() {
|
private registerListeners() {
|
||||||
this.queue.on('error', (error: Error) => {
|
|
||||||
if ('code' in error && error.code === 'ECONNREFUSED') return; // handled by RedisClientService.retryStrategy
|
|
||||||
|
|
||||||
this.logger.error('[ScalingService] Queue errored', { error });
|
|
||||||
|
|
||||||
throw error;
|
|
||||||
});
|
|
||||||
|
|
||||||
const { instanceType } = this.instanceSettings;
|
const { instanceType } = this.instanceSettings;
|
||||||
if (instanceType === 'main' || instanceType === 'webhook') {
|
if (instanceType === 'main' || instanceType === 'webhook') {
|
||||||
this.registerMainOrWebhookListeners();
|
this.registerMainOrWebhookListeners();
|
||||||
|
@ -230,6 +222,8 @@ export class ScalingService {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.queue.on('error', (error: Error) => {
|
this.queue.on('error', (error: Error) => {
|
||||||
|
if ('code' in error && error.code === 'ECONNREFUSED') return; // handled by RedisClientService.retryStrategy
|
||||||
|
|
||||||
if (error.message.includes('job stalled more than maxStalledCount')) {
|
if (error.message.includes('job stalled more than maxStalledCount')) {
|
||||||
throw new MaxStalledCountError(error);
|
throw new MaxStalledCountError(error);
|
||||||
}
|
}
|
||||||
|
@ -244,6 +238,8 @@ export class ScalingService {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.logger.error('[ScalingService] Queue errored', { error });
|
||||||
|
|
||||||
throw error;
|
throw error;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -252,6 +248,14 @@ export class ScalingService {
|
||||||
* Register listeners on a `main` or `webhook` process for Bull queue events.
|
* Register listeners on a `main` or `webhook` process for Bull queue events.
|
||||||
*/
|
*/
|
||||||
private registerMainOrWebhookListeners() {
|
private registerMainOrWebhookListeners() {
|
||||||
|
this.queue.on('error', (error: Error) => {
|
||||||
|
if ('code' in error && error.code === 'ECONNREFUSED') return; // handled by RedisClientService.retryStrategy
|
||||||
|
|
||||||
|
this.logger.error('[ScalingService] Queue errored', { error });
|
||||||
|
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
|
|
||||||
this.queue.on('global:progress', (_jobId: JobId, msg: unknown) => {
|
this.queue.on('global:progress', (_jobId: JobId, msg: unknown) => {
|
||||||
if (!this.isPubSubMessage(msg)) return;
|
if (!this.isPubSubMessage(msg)) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue