mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(core): Fix orchestration flow with expired license (#12444)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { GlobalConfig } from '@n8n/config';
|
||||
import { Container } from '@n8n/di';
|
||||
import { Flags } from '@oclif/core';
|
||||
import glob from 'fast-glob';
|
||||
@@ -21,7 +20,6 @@ import { FeatureNotLicensedError } from '@/errors/feature-not-licensed.error';
|
||||
import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus';
|
||||
import { EventService } from '@/events/event.service';
|
||||
import { ExecutionService } from '@/executions/execution.service';
|
||||
import { License } from '@/license';
|
||||
import { PubSubHandler } from '@/scaling/pubsub/pubsub-handler';
|
||||
import { Subscriber } from '@/scaling/pubsub/subscriber.service';
|
||||
import { Server } from '@/server';
|
||||
@@ -192,18 +190,23 @@ export class Start extends BaseCommand {
|
||||
await super.init();
|
||||
this.activeWorkflowManager = Container.get(ActiveWorkflowManager);
|
||||
|
||||
this.instanceSettings.setMultiMainEnabled(
|
||||
config.getEnv('executions.mode') === 'queue' && this.globalConfig.multiMainSetup.enabled,
|
||||
);
|
||||
await this.initLicense();
|
||||
const isMultiMainEnabled =
|
||||
config.getEnv('executions.mode') === 'queue' && this.globalConfig.multiMainSetup.enabled;
|
||||
|
||||
this.instanceSettings.setMultiMainEnabled(isMultiMainEnabled);
|
||||
|
||||
/**
|
||||
* We temporarily license multi-main to allow orchestration to set instance
|
||||
* role, which is needed by license init. Once the license is initialized,
|
||||
* the actual value will be used for the license check.
|
||||
*/
|
||||
if (isMultiMainEnabled) this.instanceSettings.setMultiMainLicensed(true);
|
||||
|
||||
await this.initOrchestration();
|
||||
this.logger.debug('Orchestration init complete');
|
||||
await this.initLicense();
|
||||
|
||||
if (!this.globalConfig.license.autoRenewalEnabled && this.instanceSettings.isLeader) {
|
||||
this.logger.warn(
|
||||
'Automatic license renewal is disabled. The license will not renew automatically, and access to licensed features may be lost!',
|
||||
);
|
||||
if (isMultiMainEnabled && !this.license.isMultiMainLicensed()) {
|
||||
throw new FeatureNotLicensedError(LICENSE_FEATURES.MULTIPLE_MAIN_INSTANCES);
|
||||
}
|
||||
|
||||
Container.get(WaitTracker).init();
|
||||
@@ -237,13 +240,6 @@ export class Start extends BaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
Container.get(GlobalConfig).multiMainSetup.enabled &&
|
||||
!Container.get(License).isMultipleMainInstancesLicensed()
|
||||
) {
|
||||
throw new FeatureNotLicensedError(LICENSE_FEATURES.MULTIPLE_MAIN_INSTANCES);
|
||||
}
|
||||
|
||||
const orchestrationService = Container.get(OrchestrationService);
|
||||
|
||||
await orchestrationService.init();
|
||||
|
||||
Reference in New Issue
Block a user