Skip to content

Commit

Permalink
refactor: Add log messages to debug worker init issues (#7238)
Browse files Browse the repository at this point in the history
Github issue / Community forum post (link here to close automatically):
  • Loading branch information
krynble authored Oct 5, 2023
1 parent 1691750 commit 5cfd876
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/cli/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/src/commands/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,21 @@ 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}`);

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() {
Expand Down
13 changes: 12 additions & 1 deletion packages/cli/src/commands/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 5cfd876

Please sign in to comment.