mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor(core): Couple of refactors on WorkflowRunner and ActiveExecutions (no-changelog) (#8487)
This commit is contained in:
committed by
GitHub
parent
dc068ce2e6
commit
c04f92f7fd
@@ -1,6 +1,6 @@
|
||||
import { Container } from 'typedi';
|
||||
import { Flags, type Config } from '@oclif/core';
|
||||
import { ApplicationError, sleep } from 'n8n-workflow';
|
||||
import { ApplicationError } from 'n8n-workflow';
|
||||
|
||||
import config from '@/config';
|
||||
import { ActiveExecutions } from '@/ActiveExecutions';
|
||||
@@ -42,21 +42,7 @@ export class Webhook extends BaseCommand {
|
||||
try {
|
||||
await this.externalHooks?.run('n8n.stop', []);
|
||||
|
||||
// Wait for active workflow executions to finish
|
||||
const activeExecutionsInstance = Container.get(ActiveExecutions);
|
||||
let executingWorkflows = activeExecutionsInstance.getActiveExecutions();
|
||||
|
||||
let count = 0;
|
||||
while (executingWorkflows.length !== 0) {
|
||||
if (count++ % 4 === 0) {
|
||||
this.logger.info(
|
||||
`Waiting for ${executingWorkflows.length} active executions to finish...`,
|
||||
);
|
||||
}
|
||||
|
||||
await sleep(500);
|
||||
executingWorkflows = activeExecutionsInstance.getActiveExecutions();
|
||||
}
|
||||
await Container.get(ActiveExecutions).shutdown();
|
||||
} catch (error) {
|
||||
await this.exitWithCrash('There was an error shutting down n8n.', error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user