mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
fix(core): Fix shutdown if terminating before hooks are initialized (#8047)
If the app receives termination signal before hooks have been initialised, the would be objet is undefined error. This PR fixes that.
This commit is contained in:
@@ -79,7 +79,7 @@ export class Worker extends BaseCommand {
|
||||
await Worker.jobQueue.pause(true);
|
||||
|
||||
try {
|
||||
await this.externalHooks.run('n8n.stop', []);
|
||||
await this.externalHooks?.run('n8n.stop', []);
|
||||
|
||||
const maxStopTime = config.getEnv('queue.bull.gracefulShutdownTimeout') * 1000;
|
||||
|
||||
@@ -483,7 +483,7 @@ export class Worker extends BaseCommand {
|
||||
});
|
||||
|
||||
await new Promise<void>((resolve) => server.listen(port, () => resolve()));
|
||||
await this.externalHooks.run('worker.ready');
|
||||
await this.externalHooks?.run('worker.ready');
|
||||
this.logger.info(`\nn8n worker health check via, port ${port}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user