mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): Streamline flows in multi-main mode (no-changelog) (#8446)
This commit is contained in:
@@ -226,31 +226,11 @@ export class Start extends BaseCommand {
|
||||
if (!orchestrationService.isMultiMainSetupEnabled) return;
|
||||
|
||||
orchestrationService.multiMainSetup
|
||||
.addListener('leadershipChange', async () => {
|
||||
if (orchestrationService.isLeader) {
|
||||
this.logger.debug('[Leadership change] Clearing all activation errors...');
|
||||
|
||||
await this.activeWorkflowRunner.clearAllActivationErrors();
|
||||
|
||||
this.logger.debug(
|
||||
'[Leadership change] Adding all trigger- and poller-based workflows...',
|
||||
);
|
||||
|
||||
await this.activeWorkflowRunner.addAllTriggerAndPollerBasedWorkflows();
|
||||
} else {
|
||||
this.logger.debug(
|
||||
'[Leadership change] Removing all trigger- and poller-based workflows...',
|
||||
);
|
||||
|
||||
await this.activeWorkflowRunner.removeAllTriggerAndPollerBasedWorkflows();
|
||||
}
|
||||
})
|
||||
.addListener('leadershipVacant', async () => {
|
||||
this.logger.debug(
|
||||
'[Leadership vacant] Removing all trigger- and poller-based workflows...',
|
||||
);
|
||||
|
||||
.on('leader-stepdown', async () => {
|
||||
await this.activeWorkflowRunner.removeAllTriggerAndPollerBasedWorkflows();
|
||||
})
|
||||
.on('leader-takeover', async () => {
|
||||
await this.activeWorkflowRunner.addAllTriggerAndPollerBasedWorkflows();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -370,16 +350,8 @@ export class Start extends BaseCommand {
|
||||
if (!orchestrationService.isMultiMainSetupEnabled) return;
|
||||
|
||||
orchestrationService.multiMainSetup
|
||||
.addListener('leadershipChange', async () => {
|
||||
if (orchestrationService.isLeader) {
|
||||
this.pruningService.startPruning();
|
||||
} else {
|
||||
this.pruningService.stopPruning();
|
||||
}
|
||||
})
|
||||
.addListener('leadershipVacant', () => {
|
||||
this.pruningService.stopPruning();
|
||||
});
|
||||
.on('leader-stepdown', () => this.pruningService.stopPruning())
|
||||
.on('leader-takeover', () => this.pruningService.startPruning());
|
||||
}
|
||||
|
||||
async catch(error: Error) {
|
||||
|
||||
Reference in New Issue
Block a user