mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +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
@@ -8,7 +8,7 @@ import { createReadStream, createWriteStream, existsSync } from 'fs';
|
||||
import { pipeline } from 'stream/promises';
|
||||
import replaceStream from 'replacestream';
|
||||
import glob from 'fast-glob';
|
||||
import { sleep, jsonParse } from 'n8n-workflow';
|
||||
import { jsonParse } from 'n8n-workflow';
|
||||
|
||||
import config from '@/config';
|
||||
import { ActiveExecutions } from '@/ActiveExecutions';
|
||||
@@ -106,23 +106,7 @@ export class Start extends BaseCommand {
|
||||
|
||||
await Container.get(InternalHooks).onN8nStop();
|
||||
|
||||
// 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) {
|
||||
console.log(`Waiting for ${executingWorkflows.length} active executions to finish...`);
|
||||
|
||||
executingWorkflows.map((execution) => {
|
||||
console.log(` - Execution ID ${execution.id}, workflow ID: ${execution.workflowId}`);
|
||||
});
|
||||
}
|
||||
|
||||
await sleep(500);
|
||||
executingWorkflows = activeExecutionsInstance.getActiveExecutions();
|
||||
}
|
||||
await Container.get(ActiveExecutions).shutdown();
|
||||
|
||||
// Finally shut down Event Bus
|
||||
await Container.get(MessageEventBus).close();
|
||||
|
||||
Reference in New Issue
Block a user