Skip to content

Commit

Permalink
fix(core): Fix worker logs relay (#9919)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov committed Jul 3, 2024
1 parent e8510c2 commit 7495136
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/cli/src/commands/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import type { WorkerJobStatusSummary } from '@/services/orchestration/worker/typ
import { ServiceUnavailableError } from '@/errors/response-errors/service-unavailable.error';
import { BaseCommand } from './BaseCommand';
import { MaxStalledCountError } from '@/errors/max-stalled-count.error';
import { AuditEventRelay } from '@/eventbus/audit-event-relay.service';

export class Worker extends BaseCommand {
static description = '\nStarts a n8n worker';
Expand Down Expand Up @@ -287,6 +288,7 @@ export class Worker extends BaseCommand {
await Container.get(MessageEventBus).initialize({
workerId: this.queueModeId,
});
Container.get(AuditEventRelay).init();
}

/**
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/test/integration/commands/worker.cmd.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { type JobQueue, Queue } from '@/Queue';

import { setupTestCommand } from '@test-integration/utils/testCommand';
import { mockInstance } from '../../shared/mocking';
import { AuditEventRelay } from '@/eventbus/audit-event-relay.service';

config.set('executions.mode', 'queue');
config.set('binaryDataManager.availableModes', 'filesystem');
Expand All @@ -25,6 +26,7 @@ const externalHooks = mockInstance(ExternalHooks);
const externalSecretsManager = mockInstance(ExternalSecretsManager);
const license = mockInstance(License);
const messageEventBus = mockInstance(MessageEventBus);
const auditEventRelay = mockInstance(AuditEventRelay);
const orchestrationHandlerWorkerService = mockInstance(OrchestrationHandlerWorkerService);
const queue = mockInstance(Queue);
const orchestrationWorkerService = mockInstance(OrchestrationWorkerService);
Expand All @@ -43,6 +45,7 @@ test('worker initializes all its components', async () => {
expect(externalHooks.init).toHaveBeenCalledTimes(1);
expect(externalSecretsManager.init).toHaveBeenCalledTimes(1);
expect(messageEventBus.initialize).toHaveBeenCalledTimes(1);
expect(auditEventRelay.init).toHaveBeenCalledTimes(1);
expect(queue.init).toHaveBeenCalledTimes(1);
expect(queue.process).toHaveBeenCalledTimes(1);
expect(orchestrationWorkerService.init).toHaveBeenCalledTimes(1);
Expand Down

0 comments on commit 7495136

Please sign in to comment.