fix(core): Fix new graceful shutdown env being always overridden by deprecated env (#8503)

This commit is contained in:
Iván Ovejero 2024-02-01 11:10:40 +01:00 committed by GitHub
parent 88cf1823d3
commit cc41fc7c80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -44,7 +44,7 @@ export abstract class BaseCommand extends Command {
/**
* How long to wait for graceful shutdown before force killing the process.
*/
protected gracefulShutdownTimeoutInS: number = config.getEnv('generic.gracefulShutdownTimeout');
protected gracefulShutdownTimeoutInS = config.getEnv('generic.gracefulShutdownTimeout');
async init(): Promise<void> {
await initErrorHandling();

View file

@ -267,9 +267,10 @@ export class Worker extends BaseCommand {
}
async init() {
const configuredShutdownTimeout = config.getEnv('queue.bull.gracefulShutdownTimeout');
if (configuredShutdownTimeout) {
this.gracefulShutdownTimeoutInS = configuredShutdownTimeout;
const { QUEUE_WORKER_TIMEOUT } = process.env;
if (QUEUE_WORKER_TIMEOUT) {
this.gracefulShutdownTimeoutInS =
parseInt(QUEUE_WORKER_TIMEOUT, 10) || config.default('queue.bull.gracefulShutdownTimeout');
this.logger.warn(
'QUEUE_WORKER_TIMEOUT has been deprecated. Rename it to N8N_GRACEFUL_SHUTDOWN_TIMEOUT.',
);