parent node should wait infinitely, until the sub-workflow execution finishes

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-12-03 14:56:39 +01:00
parent e4a870d3fc
commit f7e3a651c9
No known key found for this signature in database
2 changed files with 12 additions and 5 deletions

View file

@ -14,7 +14,7 @@ import type {
RelatedExecution, RelatedExecution,
IExecuteWorkflowInfo, IExecuteWorkflowInfo,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { ApplicationError, NodeHelpers } from 'n8n-workflow'; import { ApplicationError, NodeHelpers, WAIT_TIME_UNLIMITED } from 'n8n-workflow';
import Container from 'typedi'; import Container from 'typedi';
import { BinaryDataService } from '@/BinaryData/BinaryData.service'; import { BinaryDataService } from '@/BinaryData/BinaryData.service';
@ -235,7 +235,7 @@ export const describeCommonTests = (
}); });
expect(additionalData.setExecutionStatus).toHaveBeenCalledWith('waiting'); expect(additionalData.setExecutionStatus).toHaveBeenCalledWith('waiting');
expect(runExecutionData.waitTill).toBe(waitTill); expect(runExecutionData.waitTill).toEqual(new Date(WAIT_TIME_UNLIMITED));
expect(result.waitTill).toBe(waitTill); expect(result.waitTill).toBe(waitTill);
}); });
}); });

View file

@ -22,7 +22,12 @@ import type {
ISourceData, ISourceData,
AiEvent, AiEvent,
} from 'n8n-workflow'; } 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 { Container } from 'typedi';
import { BinaryDataService } from '@/BinaryData/BinaryData.service'; import { BinaryDataService } from '@/BinaryData/BinaryData.service';
@ -122,9 +127,11 @@ export class BaseExecuteContext extends NodeExecutionContext {
parentCallbackManager, 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) { 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( const data = await this.binaryDataService.duplicateBinaryData(