fix(core): Consider timeout in shutdown an error (#8050)

If the process doesn't shutdown within a time limit, exit with error
code.

1. conceptually something timing out is an error.
2. on successful exit we close down the DB connection gracefully. On an
exit timeout we rather not do that, since it will wait for any active
connections to close and would possible block the exit.
This commit is contained in:
Tomi Turtiainen
2023-12-18 10:53:34 +02:00
committed by GitHub
parent aad57e2da1
commit 4cae976a3b
5 changed files with 21 additions and 24 deletions

View File

@@ -41,12 +41,6 @@ export class Webhook extends BaseCommand {
try {
await this.externalHooks?.run('n8n.stop', []);
setTimeout(async () => {
// In case that something goes wrong with shutdown we
// kill after max. 30 seconds no matter what
await this.exitSuccessFully();
}, 30000);
// Wait for active workflow executions to finish
const activeExecutionsInstance = Container.get(ActiveExecutions);
let executingWorkflows = activeExecutionsInstance.getActiveExecutions();