diff --git a/packages/cli/src/Interfaces.ts b/packages/cli/src/Interfaces.ts index 4d14218ecf7c4..9bbe6a9e7e1e0 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 16683b57c9acc..80e0685914384 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 32c0d6c93ccc9..4d1f32a7dc58e 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 17f09682036b6..480a2b2f80e0c 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 e34457d8af535..7c3f6119cb8ac 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;