From 7e972c78afaf950effec17d8eee16cbf86101d03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Tue, 9 Jul 2024 17:09:39 +0200 Subject: [PATCH] fix(core): Clear active execution on cancellation in scaling mode (#9979) --- .../cli/src/executions/__tests__/execution.service.test.ts | 2 ++ packages/cli/src/executions/execution.service.ts | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/packages/cli/src/executions/__tests__/execution.service.test.ts b/packages/cli/src/executions/__tests__/execution.service.test.ts index 7444ec6154..567e0c9758 100644 --- a/packages/cli/src/executions/__tests__/execution.service.test.ts +++ b/packages/cli/src/executions/__tests__/execution.service.test.ts @@ -235,6 +235,7 @@ describe('ExecutionService', () => { * Assert */ expect(waitTracker.stopExecution).not.toHaveBeenCalled(); + expect(activeExecutions.stopExecution).toHaveBeenCalled(); expect(queue.findRunningJobBy).toBeCalledWith({ executionId: execution.id }); expect(queue.stopJob).toHaveBeenCalled(); expect(executionRepository.stopDuringRun).toHaveBeenCalled(); @@ -260,6 +261,7 @@ describe('ExecutionService', () => { * Assert */ expect(waitTracker.stopExecution).toHaveBeenCalledWith(execution.id); + expect(activeExecutions.stopExecution).toHaveBeenCalled(); expect(queue.findRunningJobBy).toBeCalledWith({ executionId: execution.id }); expect(queue.stopJob).toHaveBeenCalled(); expect(executionRepository.stopDuringRun).toHaveBeenCalled(); diff --git a/packages/cli/src/executions/execution.service.ts b/packages/cli/src/executions/execution.service.ts index 45d6faca35..853dbb64ff 100644 --- a/packages/cli/src/executions/execution.service.ts +++ b/packages/cli/src/executions/execution.service.ts @@ -460,6 +460,10 @@ export class ExecutionService { return await this.stopInRegularMode(execution); } + if (this.activeExecutions.has(execution.id)) { + await this.activeExecutions.stopExecution(execution.id); + } + if (this.waitTracker.has(execution.id)) { await this.waitTracker.stopExecution(execution.id); }