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; 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);
}); });

View file

@ -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);

View file

@ -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);
} }