mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 19:32:15 +00:00
fix(core): Don't send a executionFinished event to the browser with no run data if the execution has already been cleaned up (#11502)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
@@ -45,6 +45,7 @@ import {
|
||||
NodeExecutionOutput,
|
||||
sleep,
|
||||
ErrorReporterProxy,
|
||||
ExecutionCancelledError,
|
||||
} from 'n8n-workflow';
|
||||
import PCancelable from 'p-cancelable';
|
||||
|
||||
@@ -154,10 +155,6 @@ export class WorkflowExecute {
|
||||
return this.processRunExecutionData(workflow);
|
||||
}
|
||||
|
||||
static isAbortError(e?: ExecutionBaseError) {
|
||||
return e?.message === 'AbortError';
|
||||
}
|
||||
|
||||
forceInputNodeExecution(workflow: Workflow): boolean {
|
||||
return workflow.settings.executionOrder !== 'v1';
|
||||
}
|
||||
@@ -1479,7 +1476,7 @@ export class WorkflowExecute {
|
||||
// Add the execution data again so that it can get restarted
|
||||
this.runExecutionData.executionData!.nodeExecutionStack.unshift(executionData);
|
||||
// Only execute the nodeExecuteAfter hook if the node did not get aborted
|
||||
if (!WorkflowExecute.isAbortError(executionError)) {
|
||||
if (!this.isCancelled) {
|
||||
await this.executeHook('nodeExecuteAfter', [
|
||||
executionNode.name,
|
||||
taskData,
|
||||
@@ -1827,7 +1824,7 @@ export class WorkflowExecute {
|
||||
return await this.processSuccessExecution(
|
||||
startedAt,
|
||||
workflow,
|
||||
new WorkflowOperationError('Workflow has been canceled or timed out'),
|
||||
new ExecutionCancelledError(this.additionalData.executionId ?? 'unknown'),
|
||||
closeFunction,
|
||||
);
|
||||
}
|
||||
@@ -1928,7 +1925,7 @@ export class WorkflowExecute {
|
||||
|
||||
this.moveNodeMetadata();
|
||||
// Prevent from running the hook if the error is an abort error as it was already handled
|
||||
if (!WorkflowExecute.isAbortError(executionError)) {
|
||||
if (!this.isCancelled) {
|
||||
await this.executeHook('workflowExecuteAfter', [fullRunData, newStaticData]);
|
||||
}
|
||||
|
||||
@@ -1959,4 +1956,8 @@ export class WorkflowExecute {
|
||||
|
||||
return fullRunData;
|
||||
}
|
||||
|
||||
private get isCancelled() {
|
||||
return this.abortController.signal.aborted;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user