diff --git a/packages/cli/commands/worker.ts b/packages/cli/commands/worker.ts index 3ff58cb8a2..93c93918e7 100644 --- a/packages/cli/commands/worker.ts +++ b/packages/cli/commands/worker.ts @@ -85,7 +85,7 @@ export class Worker extends Command { const externalHooks = ExternalHooks(); await externalHooks.run('n8n.stop', []); - const maxStopTime = 30000; + const maxStopTime = config.getEnv('queue.bull.gracefulShutdownTimeout') * 1000; const stopTime = new Date().getTime() + maxStopTime; diff --git a/packages/cli/config/schema.ts b/packages/cli/config/schema.ts index 9d83f6e83c..209fb99331 100644 --- a/packages/cli/config/schema.ts +++ b/packages/cli/config/schema.ts @@ -351,6 +351,12 @@ export const schema = { default: 60, env: 'QUEUE_RECOVERY_INTERVAL', }, + gracefulShutdownTimeout: { + doc: 'How long should n8n wait for running executions before exiting worker process', + format: Number, + default: 30, + env: 'QUEUE_WORKER_TIMEOUT', + }, }, },