diff --git a/packages/cli/src/Interfaces.ts b/packages/cli/src/Interfaces.ts index 4d14218ecf..9bbe6a9e7e 100644 --- a/packages/cli/src/Interfaces.ts +++ b/packages/cli/src/Interfaces.ts @@ -728,6 +728,7 @@ export interface IProcessMessageDataHook { export interface IWorkflowExecutionDataProcess { destinationNode?: string; + restartExecutionId?: string; executionMode: WorkflowExecuteMode; executionData?: IRunExecutionData; runData?: IRunData; diff --git a/packages/cli/src/WorkflowRunner.ts b/packages/cli/src/WorkflowRunner.ts index 16683b57c9..80e0685914 100644 --- a/packages/cli/src/WorkflowRunner.ts +++ b/packages/cli/src/WorkflowRunner.ts @@ -271,6 +271,7 @@ export class WorkflowRunner { undefined, workflowTimeout <= 0 ? undefined : Date.now() + workflowTimeout * 1000, ); + additionalData.restartExecutionId = restartExecutionId; // Register the active execution const executionId = await this.activeExecutions.add(data, undefined, restartExecutionId); @@ -644,6 +645,8 @@ export class WorkflowRunner { data.workflowData.staticData = await WorkflowHelpers.getStaticDataById(workflowId); } + data.restartExecutionId = restartExecutionId; + // Register the active execution const executionId = await this.activeExecutions.add(data, subprocess, restartExecutionId); diff --git a/packages/cli/src/WorkflowRunnerProcess.ts b/packages/cli/src/WorkflowRunnerProcess.ts index 32c0d6c93c..4d1f32a7dc 100644 --- a/packages/cli/src/WorkflowRunnerProcess.ts +++ b/packages/cli/src/WorkflowRunnerProcess.ts @@ -170,6 +170,7 @@ class WorkflowRunnerProcess { undefined, workflowTimeout <= 0 ? undefined : Date.now() + workflowTimeout * 1000, ); + additionalData.restartExecutionId = this.data.restartExecutionId; additionalData.hooks = this.getProcessForwardHooks(); additionalData.hooks.hookFunctions.sendResponse = [ diff --git a/packages/core/src/WorkflowExecute.ts b/packages/core/src/WorkflowExecute.ts index 17f0968203..480a2b2f80 100644 --- a/packages/core/src/WorkflowExecute.ts +++ b/packages/core/src/WorkflowExecute.ts @@ -746,7 +746,9 @@ export class WorkflowExecute { const returnPromise = (async () => { try { - await this.executeHook('workflowExecuteBefore', [workflow]); + if (!this.additionalData.restartExecutionId) { + await this.executeHook('workflowExecuteBefore', [workflow]); + } } catch (error) { // Set the error that it can be saved correctly executionError = { diff --git a/packages/workflow/src/Interfaces.ts b/packages/workflow/src/Interfaces.ts index e34457d8af..7c3f6119cb 100644 --- a/packages/workflow/src/Interfaces.ts +++ b/packages/workflow/src/Interfaces.ts @@ -1677,6 +1677,7 @@ export interface IWorkflowExecuteAdditionalData { ) => Promise; // hooks?: IWorkflowExecuteHooks; executionId?: string; + restartExecutionId?: string; hooks?: WorkflowHooks; httpResponse?: express.Response; httpRequest?: express.Request;