mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(core): Add unique id to instances (#6863)
* add serverId and workerId * adjust id format * fix logger init / test * update implementation
This commit is contained in:
committed by
GitHub
parent
f038e1e9a6
commit
6499f42481
@@ -23,6 +23,9 @@ import { N8N_VERSION } from '@/constants';
|
||||
import { BaseCommand } from './BaseCommand';
|
||||
import { ExecutionRepository } from '@db/repositories';
|
||||
import { OwnershipService } from '@/services/ownership.service';
|
||||
import { generateHostInstanceId } from '@/databases/utils/generators';
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { IConfig } from '@oclif/config';
|
||||
|
||||
export class Worker extends BaseCommand {
|
||||
static description = '\nStarts a n8n worker';
|
||||
@@ -43,6 +46,13 @@ export class Worker extends BaseCommand {
|
||||
|
||||
static jobQueue: JobQueue;
|
||||
|
||||
readonly uniqueInstanceId: string;
|
||||
|
||||
constructor(argv: string[], cmdConfig: IConfig) {
|
||||
super(argv, cmdConfig);
|
||||
this.uniqueInstanceId = generateHostInstanceId('worker');
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop n8n in a graceful way.
|
||||
* Make for example sure that all the webhooks from third party services
|
||||
@@ -227,6 +237,7 @@ export class Worker extends BaseCommand {
|
||||
async init() {
|
||||
await this.initCrashJournal();
|
||||
await super.init();
|
||||
this.logger.debug(`Worker ID: ${this.uniqueInstanceId}`);
|
||||
this.logger.debug('Starting n8n worker...');
|
||||
|
||||
await this.initLicense();
|
||||
|
||||
Reference in New Issue
Block a user