diff --git a/packages/core/src/node-execution-context/__tests__/shared-tests.ts b/packages/core/src/node-execution-context/__tests__/shared-tests.ts index 80cf3900d7..72a53a0d9f 100644 --- a/packages/core/src/node-execution-context/__tests__/shared-tests.ts +++ b/packages/core/src/node-execution-context/__tests__/shared-tests.ts @@ -14,7 +14,7 @@ import type { RelatedExecution, IExecuteWorkflowInfo, } from 'n8n-workflow'; -import { ApplicationError, NodeHelpers } from 'n8n-workflow'; +import { ApplicationError, NodeHelpers, WAIT_TIME_UNLIMITED } from 'n8n-workflow'; import Container from 'typedi'; import { BinaryDataService } from '@/BinaryData/BinaryData.service'; @@ -235,7 +235,7 @@ export const describeCommonTests = ( }); expect(additionalData.setExecutionStatus).toHaveBeenCalledWith('waiting'); - expect(runExecutionData.waitTill).toBe(waitTill); + expect(runExecutionData.waitTill).toEqual(new Date(WAIT_TIME_UNLIMITED)); expect(result.waitTill).toBe(waitTill); }); }); diff --git a/packages/core/src/node-execution-context/base-execute-context.ts b/packages/core/src/node-execution-context/base-execute-context.ts index 39aeedfc19..eed2d29684 100644 --- a/packages/core/src/node-execution-context/base-execute-context.ts +++ b/packages/core/src/node-execution-context/base-execute-context.ts @@ -22,7 +22,12 @@ import type { ISourceData, AiEvent, } from 'n8n-workflow'; -import { ApplicationError, NodeHelpers, WorkflowDataProxy } from 'n8n-workflow'; +import { + ApplicationError, + NodeHelpers, + WAIT_TIME_UNLIMITED, + WorkflowDataProxy, +} from 'n8n-workflow'; import { Container } from 'typedi'; import { BinaryDataService } from '@/BinaryData/BinaryData.service'; @@ -122,9 +127,11 @@ export class BaseExecuteContext extends NodeExecutionContext { parentCallbackManager, }); - // If a sub-workflow execution goes into the waiting state, then put the parent workflow execution also into the waiting state + // If a sub-workflow execution goes into the waiting state if (result.waitTill) { - await this.putExecutionToWait(result.waitTill); + // then put the parent workflow execution also into the waiting state, + // but do not use the sub-workflow `waitTill` to avoid WaitTracker resuming the parent execution at the same time as the sub-workflow + await this.putExecutionToWait(new Date(WAIT_TIME_UNLIMITED)); } const data = await this.binaryDataService.duplicateBinaryData(