mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): Make PruningService.init and WaitTracker.init consistent (no-changelog) (#9761)
This commit is contained in:
@@ -199,7 +199,10 @@ export class Start extends BaseCommand {
|
||||
}
|
||||
|
||||
async initOrchestration() {
|
||||
if (config.getEnv('executions.mode') !== 'queue') return;
|
||||
if (config.getEnv('executions.mode') === 'regular') {
|
||||
config.set('multiMainSetup.instanceType', 'leader');
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
config.getEnv('multiMainSetup.enabled') &&
|
||||
@@ -290,7 +293,7 @@ export class Start extends BaseCommand {
|
||||
|
||||
await this.server.start();
|
||||
|
||||
await this.initPruning();
|
||||
Container.get(PruningService).init();
|
||||
|
||||
if (config.getEnv('executions.mode') === 'regular') {
|
||||
await this.runEnqueuedExecutions();
|
||||
@@ -333,24 +336,6 @@ export class Start extends BaseCommand {
|
||||
}
|
||||
}
|
||||
|
||||
async initPruning() {
|
||||
this.pruningService = Container.get(PruningService);
|
||||
|
||||
this.pruningService.startPruning();
|
||||
|
||||
if (config.getEnv('executions.mode') !== 'queue') return;
|
||||
|
||||
const orchestrationService = Container.get(OrchestrationService);
|
||||
|
||||
await orchestrationService.init();
|
||||
|
||||
if (!orchestrationService.isMultiMainSetupEnabled) return;
|
||||
|
||||
orchestrationService.multiMainSetup
|
||||
.on('leader-stepdown', () => this.pruningService.stopPruning())
|
||||
.on('leader-takeover', () => this.pruningService.startPruning());
|
||||
}
|
||||
|
||||
async catch(error: Error) {
|
||||
if (error.stack) this.logger.error(error.stack);
|
||||
await this.exitWithCrash('Exiting due to an error.', error);
|
||||
|
||||
Reference in New Issue
Block a user