mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-02 07:01:30 -08:00
parent node should wait infinitely, until the sub-workflow execution finishes
This commit is contained in:
parent
e4a870d3fc
commit
f7e3a651c9
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue