refactor(core): Decouple event bus from internal hooks (no-changelog) (#9724)

This commit is contained in:
Iván Ovejero
2024-06-20 12:32:22 +02:00
committed by GitHub
parent e4463c62b4
commit 199dff4fb3
29 changed files with 1028 additions and 664 deletions

View File

@@ -20,6 +20,8 @@ import { NodeCrashedError } from '@/errors/node-crashed.error';
import { WorkflowCrashedError } from '@/errors/workflow-crashed.error';
import { EventMessageNode } from '@/eventbus/EventMessageClasses/EventMessageNode';
import { EventMessageWorkflow } from '@/eventbus/EventMessageClasses/EventMessageWorkflow';
import type { EventRelay } from '@/eventbus/event-relay.service';
import type { EventMessageTypes as EventMessage } from '@/eventbus/EventMessageClasses';
import type { Logger } from '@/Logger';
@@ -191,6 +193,7 @@ describe('ExecutionRecoveryService', () => {
push,
executionRepository,
orchestrationService,
mock<EventRelay>(),
);
});

View File

@@ -16,6 +16,7 @@ import config from '@/config';
import { OnShutdown } from '@/decorators/OnShutdown';
import type { QueueRecoverySettings } from './execution.types';
import { OrchestrationService } from '@/services/orchestration.service';
import { EventRelay } from '@/eventbus/event-relay.service';
/**
* Service for recovering key properties in executions.
@@ -27,6 +28,7 @@ export class ExecutionRecoveryService {
private readonly push: Push,
private readonly executionRepository: ExecutionRepository,
private readonly orchestrationService: OrchestrationService,
private readonly eventRelay: EventRelay,
) {}
/**
@@ -284,6 +286,14 @@ export class ExecutionRecoveryService {
status: execution.status,
});
this.eventRelay.emit('workflow-post-execute', {
workflowId: execution.workflowData.id,
workflowName: execution.workflowData.name,
executionId: execution.id,
success: execution.status === 'success',
isManual: execution.mode === 'manual',
});
const externalHooks = getWorkflowHooksMain(
{
userId: '',