From 5cfd87692fdbbc90ebeac6b3f3bb689f8001a957 Mon Sep 17 00:00:00 2001 From: Omar Ajoue Date: Thu, 5 Oct 2023 13:37:25 +0200 Subject: [PATCH] refactor: Add log messages to debug worker init issues (#7238) Github issue / Community forum post (link here to close automatically): --- packages/cli/src/commands/start.ts | 5 +++++ packages/cli/src/commands/webhook.ts | 5 +++++ packages/cli/src/commands/worker.ts | 13 ++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/start.ts b/packages/cli/src/commands/start.ts index 1ddf804baea8d..df3f42faa9096 100644 --- a/packages/cli/src/commands/start.ts +++ b/packages/cli/src/commands/start.ts @@ -213,10 +213,15 @@ export class Start extends BaseCommand { this.activeWorkflowRunner = Container.get(ActiveWorkflowRunner); await this.initLicense(); + this.logger.debug('License init complete'); await this.initBinaryDataService(); + this.logger.debug('Binary data service init complete'); await this.initExternalHooks(); + this.logger.debug('External hooks init complete'); await this.initExternalSecrets(); + this.logger.debug('External secrets init complete'); this.initWorkflowHistory(); + this.logger.debug('Workflow history init complete'); if (!config.getEnv('endpoints.disableUi')) { await this.generateStaticAssets(); diff --git a/packages/cli/src/commands/webhook.ts b/packages/cli/src/commands/webhook.ts index 2c3ee358995d9..bc33a80531b40 100644 --- a/packages/cli/src/commands/webhook.ts +++ b/packages/cli/src/commands/webhook.ts @@ -85,6 +85,7 @@ export class Webhook extends BaseCommand { } await this.initCrashJournal(); + this.logger.debug('Crash journal initialized'); this.logger.info('Initializing n8n webhook process'); this.logger.debug(`Queue mode id: ${this.queueModeId}`); @@ -92,9 +93,13 @@ export class Webhook extends BaseCommand { await super.init(); await this.initLicense(); + this.logger.debug('License init complete'); await this.initBinaryDataService(); + this.logger.debug('Binary data service init complete'); await this.initExternalHooks(); + this.logger.debug('External hooks init complete'); await this.initExternalSecrets(); + this.logger.debug('External seecrets init complete'); } async run() { diff --git a/packages/cli/src/commands/worker.ts b/packages/cli/src/commands/worker.ts index 5445b85f1fd9f..b784adc1efd6d 100644 --- a/packages/cli/src/commands/worker.ts +++ b/packages/cli/src/commands/worker.ts @@ -263,13 +263,19 @@ export class Worker extends BaseCommand { await super.init(); await this.initLicense(); - + this.logger.debug('License init complete'); await this.initBinaryDataService(); + this.logger.debug('Binary data service init complete'); await this.initExternalHooks(); + this.logger.debug('External hooks init complete'); await this.initExternalSecrets(); + this.logger.debug('External secrets init complete'); await this.initEventBus(); + this.logger.debug('Event bus init complete'); await this.initRedis(); + this.logger.debug('Redis init complete'); await this.initQueue(); + this.logger.debug('Queue init complete'); } async initEventBus() { @@ -315,8 +321,13 @@ export class Worker extends BaseCommand { const redisConnectionTimeoutLimit = config.getEnv('queue.bull.redis.timeoutThreshold'); + this.logger.debug( + `Opening Redis connection to listen to messages with timeout ${redisConnectionTimeoutLimit}`, + ); + const queue = Container.get(Queue); await queue.init(); + this.logger.debug('Queue singleton ready'); Worker.jobQueue = queue.getBullObjectInstance(); void Worker.jobQueue.process(flags.concurrency, async (job) => this.runJob(job, this.nodeTypes),