address PR comments

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-12-02 14:28:33 +01:00
parent 1aabca8319
commit d407726da4
No known key found for this signature in database
3 changed files with 8 additions and 6 deletions

View file

@ -138,6 +138,7 @@ export class WaitTracker {
const { parentExecution } = fullExecutionData.data;
if (parentExecution) {
// on child execution completion, resume parent execution
void this.activeExecutions.getPostExecutePromise(executionId).then(() => {
void this.startExecution(parentExecution.executionId);
});

View file

@ -48,7 +48,7 @@ import type { Project } from '@/databases/entities/project';
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
import { NotFoundError } from '@/errors/response-errors/not-found.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 { parseBody } from '@/middlewares';
import { OwnershipService } from '@/services/ownership.service';
@ -549,13 +549,14 @@ export async function executeWebhook(
{ executionId },
);
const activeExecutions = Container.get(ActiveExecutions);
// Get a promise which resolves when the workflow did execute and send then response
const executePromise = Container.get(ActiveExecutions).getPostExecutePromise(
executionId,
) as Promise<IExecutionDb | undefined>;
const executePromise = activeExecutions.getPostExecutePromise(executionId);
const { parentExecution } = runExecutionData;
if (parentExecution) {
// on child execution completion, resume parent execution
void executePromise.then(() => {
const waitTracker = Container.get(WaitTracker);
void waitTracker.startExecution(parentExecution.executionId);

View file

@ -115,14 +115,14 @@ export class BaseExecuteContext extends NodeExecutionContext {
): Promise<ExecuteWorkflowData> {
const result = await this.additionalData.executeWorkflow(workflowInfo, this.additionalData, {
...options,
parentWorkflowId: this.workflow.id?.toString(),
parentWorkflowId: this.workflow.id,
inputData,
parentWorkflowSettings: this.workflow.settings,
node: this.node,
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) {
await this.putExecutionToWait(result.waitTill);
}