fix(core): Do not emit workflow-post-execute event for waiting executions (#13065)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-02-06 13:37:13 +01:00
committed by GitHub
parent a37c8e8fb8
commit 1593b6cb41
6 changed files with 8 additions and 30 deletions

View File

@@ -126,6 +126,12 @@ describe('Execution Lifecycle Hooks', () => {
workflow: workflowData,
});
});
it('should not emit workflow-post-execute events for waiting executions', async () => {
await hooks.executeHookFunctions('workflowExecuteAfter', [waitingRun, {}]);
expect(eventService.emit).not.toHaveBeenCalledWith('workflow-post-execute');
});
});
};

View File

@@ -68,6 +68,8 @@ function hookFunctionsWorkflowEvents(userId?: string): IWorkflowExecuteHooks {
],
workflowExecuteAfter: [
async function (this: WorkflowHooks, runData: IRun): Promise<void> {
if (runData.status === 'waiting') return;
const { executionId, workflowData: workflow } = this;
eventService.emit('workflow-post-execute', { executionId, runData, workflow, userId });
},