mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
address PR comments
This commit is contained in:
parent
1aabca8319
commit
d407726da4
|
@ -138,6 +138,7 @@ export class WaitTracker {
|
||||||
|
|
||||||
const { parentExecution } = fullExecutionData.data;
|
const { parentExecution } = fullExecutionData.data;
|
||||||
if (parentExecution) {
|
if (parentExecution) {
|
||||||
|
// on child execution completion, resume parent execution
|
||||||
void this.activeExecutions.getPostExecutePromise(executionId).then(() => {
|
void this.activeExecutions.getPostExecutePromise(executionId).then(() => {
|
||||||
void this.startExecution(parentExecution.executionId);
|
void this.startExecution(parentExecution.executionId);
|
||||||
});
|
});
|
||||||
|
|
|
@ -48,7 +48,7 @@ import type { Project } from '@/databases/entities/project';
|
||||||
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
|
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
|
||||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||||
import { UnprocessableRequestError } from '@/errors/response-errors/unprocessable.error';
|
import { UnprocessableRequestError } from '@/errors/response-errors/unprocessable.error';
|
||||||
import type { IExecutionDb, IWorkflowDb } from '@/interfaces';
|
import type { IWorkflowDb } from '@/interfaces';
|
||||||
import { Logger } from '@/logging/logger.service';
|
import { Logger } from '@/logging/logger.service';
|
||||||
import { parseBody } from '@/middlewares';
|
import { parseBody } from '@/middlewares';
|
||||||
import { OwnershipService } from '@/services/ownership.service';
|
import { OwnershipService } from '@/services/ownership.service';
|
||||||
|
@ -549,13 +549,14 @@ export async function executeWebhook(
|
||||||
{ executionId },
|
{ executionId },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const activeExecutions = Container.get(ActiveExecutions);
|
||||||
|
|
||||||
// Get a promise which resolves when the workflow did execute and send then response
|
// Get a promise which resolves when the workflow did execute and send then response
|
||||||
const executePromise = Container.get(ActiveExecutions).getPostExecutePromise(
|
const executePromise = activeExecutions.getPostExecutePromise(executionId);
|
||||||
executionId,
|
|
||||||
) as Promise<IExecutionDb | undefined>;
|
|
||||||
|
|
||||||
const { parentExecution } = runExecutionData;
|
const { parentExecution } = runExecutionData;
|
||||||
if (parentExecution) {
|
if (parentExecution) {
|
||||||
|
// on child execution completion, resume parent execution
|
||||||
void executePromise.then(() => {
|
void executePromise.then(() => {
|
||||||
const waitTracker = Container.get(WaitTracker);
|
const waitTracker = Container.get(WaitTracker);
|
||||||
void waitTracker.startExecution(parentExecution.executionId);
|
void waitTracker.startExecution(parentExecution.executionId);
|
||||||
|
|
|
@ -115,14 +115,14 @@ export class BaseExecuteContext extends NodeExecutionContext {
|
||||||
): Promise<ExecuteWorkflowData> {
|
): Promise<ExecuteWorkflowData> {
|
||||||
const result = await this.additionalData.executeWorkflow(workflowInfo, this.additionalData, {
|
const result = await this.additionalData.executeWorkflow(workflowInfo, this.additionalData, {
|
||||||
...options,
|
...options,
|
||||||
parentWorkflowId: this.workflow.id?.toString(),
|
parentWorkflowId: this.workflow.id,
|
||||||
inputData,
|
inputData,
|
||||||
parentWorkflowSettings: this.workflow.settings,
|
parentWorkflowSettings: this.workflow.settings,
|
||||||
node: this.node,
|
node: this.node,
|
||||||
parentCallbackManager,
|
parentCallbackManager,
|
||||||
});
|
});
|
||||||
|
|
||||||
// If a subworkflow goes into the waiting state, then put the parent workflow also into the waiting state
|
// If a sub-workflow execution goes into the waiting state, then put the parent workflow execution also into the waiting state
|
||||||
if (result.waitTill) {
|
if (result.waitTill) {
|
||||||
await this.putExecutionToWait(result.waitTill);
|
await this.putExecutionToWait(result.waitTill);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue