mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 05:04:05 -08:00
feat(core): Add N8N_GRACEFUL_SHUTDOWN_TIMEOUT env var (#8068)
Add generic N8N_GRACEFUL_SHUTDOWN_TIMEOUT which controls how long n8n process will wait for graceful exit before exitting forcefully. This variables replaces the QUEUE_WORKER_TIMEOUT variable that was used for worker process. DEPRECATED: QUEUE_WORKER_TIMEOUT deprected QUEUE_WORKER_TIMEOUT environment variable has been replaced with N8N_GRACEFUL_SHUTDOWN_TIMEOUT.
This commit is contained in:
parent
0590ac7826
commit
614f488386
|
@ -42,9 +42,8 @@ export abstract class BaseCommand extends Command {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How long to wait for graceful shutdown before force killing the process.
|
* How long to wait for graceful shutdown before force killing the process.
|
||||||
* Subclasses can override this value.
|
|
||||||
*/
|
*/
|
||||||
protected gracefulShutdownTimeoutInS: number = 30;
|
protected gracefulShutdownTimeoutInS: number = config.getEnv('generic.gracefulShutdownTimeout');
|
||||||
|
|
||||||
async init(): Promise<void> {
|
async init(): Promise<void> {
|
||||||
await initErrorHandling();
|
await initErrorHandling();
|
||||||
|
|
|
@ -264,7 +264,13 @@ export class Worker extends BaseCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
this.gracefulShutdownTimeoutInS = config.getEnv('queue.bull.gracefulShutdownTimeout');
|
const configuredShutdownTimeout = config.getEnv('queue.bull.gracefulShutdownTimeout');
|
||||||
|
if (configuredShutdownTimeout) {
|
||||||
|
this.gracefulShutdownTimeoutInS = configuredShutdownTimeout;
|
||||||
|
this.logger.warn(
|
||||||
|
'QUEUE_WORKER_TIMEOUT has been deprecated. Rename it to N8N_GRACEFUL_SHUTDOWN_TIMEOUT.',
|
||||||
|
);
|
||||||
|
}
|
||||||
await this.initCrashJournal();
|
await this.initCrashJournal();
|
||||||
|
|
||||||
this.logger.debug('Starting n8n worker...');
|
this.logger.debug('Starting n8n worker...');
|
||||||
|
|
|
@ -439,7 +439,7 @@ export const schema = {
|
||||||
env: 'QUEUE_RECOVERY_INTERVAL',
|
env: 'QUEUE_RECOVERY_INTERVAL',
|
||||||
},
|
},
|
||||||
gracefulShutdownTimeout: {
|
gracefulShutdownTimeout: {
|
||||||
doc: 'How long should n8n wait for running executions before exiting worker process (seconds)',
|
doc: '[DEPRECATED] (Use N8N_GRACEFUL_SHUTDOWN_TIMEOUT instead) How long should n8n wait for running executions before exiting worker process (seconds)',
|
||||||
format: Number,
|
format: Number,
|
||||||
default: 30,
|
default: 30,
|
||||||
env: 'QUEUE_WORKER_TIMEOUT',
|
env: 'QUEUE_WORKER_TIMEOUT',
|
||||||
|
@ -497,6 +497,13 @@ export const schema = {
|
||||||
default: 'dev',
|
default: 'dev',
|
||||||
env: 'N8N_RELEASE_TYPE',
|
env: 'N8N_RELEASE_TYPE',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
gracefulShutdownTimeout: {
|
||||||
|
doc: 'How long should n8n process wait for components to shut down before exiting the process (seconds)',
|
||||||
|
format: Number,
|
||||||
|
default: 30,
|
||||||
|
env: 'N8N_GRACEFUL_SHUTDOWN_TIMEOUT',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
// How n8n can be reached (Editor & REST-API)
|
// How n8n can be reached (Editor & REST-API)
|
||||||
|
|
Loading…
Reference in a new issue