From 3f27eaa5161294c06dcb2b2c9353d8c26db6e3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Mon, 29 Jan 2024 15:58:48 +0100 Subject: [PATCH] fix(core): Fix stopping and retrying failed executions --- .../src/databases/repositories/execution.repository.ts | 10 ++++++++++ .../cli/src/executions/active-execution.service.ts | 2 +- packages/cli/src/executions/execution.service.ts | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/databases/repositories/execution.repository.ts b/packages/cli/src/databases/repositories/execution.repository.ts index 3f17767d0f7d3..4a0f712be216b 100644 --- a/packages/cli/src/databases/repositories/execution.repository.ts +++ b/packages/cli/src/databases/repositories/execution.repository.ts @@ -649,6 +649,16 @@ export class ExecutionRepository extends Repository { }); } + async findWithUnflattenedData(executionId: string, accessibleWorkflowIds: string[]) { + return await this.findSingleExecution(executionId, { + where: { + workflowId: In(accessibleWorkflowIds), + }, + includeData: true, + unflattenData: true, + }); + } + async findIfShared(executionId: string, sharedWorkflowIds: string[]) { return await this.findSingleExecution(executionId, { where: { diff --git a/packages/cli/src/executions/active-execution.service.ts b/packages/cli/src/executions/active-execution.service.ts index 335c0a7faf661..4f5918378b66f 100644 --- a/packages/cli/src/executions/active-execution.service.ts +++ b/packages/cli/src/executions/active-execution.service.ts @@ -104,7 +104,7 @@ export class ActiveExecutionService { }; } - if (!this.isRegularMode) return await this.waitTracker.stopExecution(execution.id); + if (this.isRegularMode) return await this.waitTracker.stopExecution(execution.id); // queue mode diff --git a/packages/cli/src/executions/execution.service.ts b/packages/cli/src/executions/execution.service.ts index 174b7ff44647c..8d78c17d66d23 100644 --- a/packages/cli/src/executions/execution.service.ts +++ b/packages/cli/src/executions/execution.service.ts @@ -179,10 +179,10 @@ export class ExecutionService { async retry(req: ExecutionRequest.Retry, sharedWorkflowIds: string[]) { const { id: executionId } = req.params; - const execution = (await this.executionRepository.findIfShared( + const execution = await this.executionRepository.findWithUnflattenedData( executionId, sharedWorkflowIds, - )) as unknown as IExecutionResponse; + ); if (!execution) { this.logger.info(