mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 21:19:43 -08:00
fix(core): Do not execute workflowExecuteBefore
hook when resuming executions from a waiting state (#5727)
This commit is contained in:
parent
b1e1c5b306
commit
6689451e8c
|
@ -728,6 +728,7 @@ export interface IProcessMessageDataHook {
|
||||||
|
|
||||||
export interface IWorkflowExecutionDataProcess {
|
export interface IWorkflowExecutionDataProcess {
|
||||||
destinationNode?: string;
|
destinationNode?: string;
|
||||||
|
restartExecutionId?: string;
|
||||||
executionMode: WorkflowExecuteMode;
|
executionMode: WorkflowExecuteMode;
|
||||||
executionData?: IRunExecutionData;
|
executionData?: IRunExecutionData;
|
||||||
runData?: IRunData;
|
runData?: IRunData;
|
||||||
|
|
|
@ -271,6 +271,7 @@ export class WorkflowRunner {
|
||||||
undefined,
|
undefined,
|
||||||
workflowTimeout <= 0 ? undefined : Date.now() + workflowTimeout * 1000,
|
workflowTimeout <= 0 ? undefined : Date.now() + workflowTimeout * 1000,
|
||||||
);
|
);
|
||||||
|
additionalData.restartExecutionId = restartExecutionId;
|
||||||
|
|
||||||
// Register the active execution
|
// Register the active execution
|
||||||
const executionId = await this.activeExecutions.add(data, undefined, restartExecutionId);
|
const executionId = await this.activeExecutions.add(data, undefined, restartExecutionId);
|
||||||
|
@ -644,6 +645,8 @@ export class WorkflowRunner {
|
||||||
data.workflowData.staticData = await WorkflowHelpers.getStaticDataById(workflowId);
|
data.workflowData.staticData = await WorkflowHelpers.getStaticDataById(workflowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data.restartExecutionId = restartExecutionId;
|
||||||
|
|
||||||
// Register the active execution
|
// Register the active execution
|
||||||
const executionId = await this.activeExecutions.add(data, subprocess, restartExecutionId);
|
const executionId = await this.activeExecutions.add(data, subprocess, restartExecutionId);
|
||||||
|
|
||||||
|
|
|
@ -170,6 +170,7 @@ class WorkflowRunnerProcess {
|
||||||
undefined,
|
undefined,
|
||||||
workflowTimeout <= 0 ? undefined : Date.now() + workflowTimeout * 1000,
|
workflowTimeout <= 0 ? undefined : Date.now() + workflowTimeout * 1000,
|
||||||
);
|
);
|
||||||
|
additionalData.restartExecutionId = this.data.restartExecutionId;
|
||||||
additionalData.hooks = this.getProcessForwardHooks();
|
additionalData.hooks = this.getProcessForwardHooks();
|
||||||
|
|
||||||
additionalData.hooks.hookFunctions.sendResponse = [
|
additionalData.hooks.hookFunctions.sendResponse = [
|
||||||
|
|
|
@ -746,7 +746,9 @@ export class WorkflowExecute {
|
||||||
|
|
||||||
const returnPromise = (async () => {
|
const returnPromise = (async () => {
|
||||||
try {
|
try {
|
||||||
|
if (!this.additionalData.restartExecutionId) {
|
||||||
await this.executeHook('workflowExecuteBefore', [workflow]);
|
await this.executeHook('workflowExecuteBefore', [workflow]);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Set the error that it can be saved correctly
|
// Set the error that it can be saved correctly
|
||||||
executionError = {
|
executionError = {
|
||||||
|
|
|
@ -1677,6 +1677,7 @@ export interface IWorkflowExecuteAdditionalData {
|
||||||
) => Promise<any>;
|
) => Promise<any>;
|
||||||
// hooks?: IWorkflowExecuteHooks;
|
// hooks?: IWorkflowExecuteHooks;
|
||||||
executionId?: string;
|
executionId?: string;
|
||||||
|
restartExecutionId?: string;
|
||||||
hooks?: WorkflowHooks;
|
hooks?: WorkflowHooks;
|
||||||
httpResponse?: express.Response;
|
httpResponse?: express.Response;
|
||||||
httpRequest?: express.Request;
|
httpRequest?: express.Request;
|
||||||
|
|
Loading…
Reference in a new issue