mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
refactor(core): Move multi-main state to InstanceSettings (#12144)
This commit is contained in:
@@ -66,9 +66,11 @@ export class ScalingService {
|
||||
|
||||
this.registerListeners();
|
||||
|
||||
if (this.instanceSettings.isLeader) this.scheduleQueueRecovery();
|
||||
const { isLeader, isMultiMain } = this.instanceSettings;
|
||||
|
||||
if (this.orchestrationService.isMultiMainSetupEnabled) {
|
||||
if (isLeader) this.scheduleQueueRecovery();
|
||||
|
||||
if (isMultiMain) {
|
||||
this.orchestrationService.multiMainSetup
|
||||
.on('leader-takeover', () => this.scheduleQueueRecovery())
|
||||
.on('leader-stepdown', () => this.stopQueueRecovery());
|
||||
@@ -127,7 +129,7 @@ export class ScalingService {
|
||||
}
|
||||
|
||||
private async stopMain() {
|
||||
if (this.orchestrationService.isSingleMainSetup) {
|
||||
if (this.instanceSettings.isSingleMain) {
|
||||
await this.queue.pause(true, true); // no more jobs will be picked up
|
||||
this.logger.debug('Queue paused');
|
||||
}
|
||||
@@ -373,7 +375,7 @@ export class ScalingService {
|
||||
return (
|
||||
this.globalConfig.endpoints.metrics.includeQueueMetrics &&
|
||||
this.instanceSettings.instanceType === 'main' &&
|
||||
!this.orchestrationService.isMultiMainSetupEnabled
|
||||
this.instanceSettings.isSingleMain
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user