mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-24 04:59:13 +00:00
fix(core): Fix execution cancellation issues in scaling mode (#12343)
This commit is contained in:
@@ -242,8 +242,8 @@ describe('ExecutionService', () => {
|
||||
*/
|
||||
expect(waitTracker.stopExecution).not.toHaveBeenCalled();
|
||||
expect(activeExecutions.stopExecution).toHaveBeenCalled();
|
||||
expect(scalingService.findJobsByStatus).toHaveBeenCalled();
|
||||
expect(scalingService.stopJob).toHaveBeenCalled();
|
||||
expect(scalingService.findJobsByStatus).not.toHaveBeenCalled();
|
||||
expect(scalingService.stopJob).not.toHaveBeenCalled();
|
||||
expect(executionRepository.stopDuringRun).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -268,8 +268,8 @@ describe('ExecutionService', () => {
|
||||
* Assert
|
||||
*/
|
||||
expect(waitTracker.stopExecution).toHaveBeenCalledWith(execution.id);
|
||||
expect(scalingService.findJobsByStatus).toHaveBeenCalled();
|
||||
expect(scalingService.stopJob).toHaveBeenCalled();
|
||||
expect(scalingService.findJobsByStatus).not.toHaveBeenCalled();
|
||||
expect(scalingService.stopJob).not.toHaveBeenCalled();
|
||||
expect(executionRepository.stopDuringRun).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
Workflow,
|
||||
WorkflowOperationError,
|
||||
} from 'n8n-workflow';
|
||||
import { Container, Service } from 'typedi';
|
||||
import { Service } from 'typedi';
|
||||
|
||||
import { ActiveExecutions } from '@/active-executions';
|
||||
import { ConcurrencyControlService } from '@/concurrency/concurrency-control.service';
|
||||
@@ -477,18 +477,6 @@ export class ExecutionService {
|
||||
this.waitTracker.stopExecution(execution.id);
|
||||
}
|
||||
|
||||
const { ScalingService } = await import('@/scaling/scaling.service');
|
||||
const scalingService = Container.get(ScalingService);
|
||||
const jobs = await scalingService.findJobsByStatus(['active', 'waiting']);
|
||||
|
||||
const job = jobs.find(({ data }) => data.executionId === execution.id);
|
||||
|
||||
if (job) {
|
||||
await scalingService.stopJob(job);
|
||||
} else {
|
||||
this.logger.debug('Job to stop not in queue', { executionId: execution.id });
|
||||
}
|
||||
|
||||
return await this.executionRepository.stopDuringRun(execution);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ export class WorkflowRunner {
|
||||
//
|
||||
// FIXME: This is a quick fix. The proper fix would be to not remove
|
||||
// the execution from the active executions while it's still running.
|
||||
if (error instanceof ExecutionNotFoundError) {
|
||||
if (error instanceof ExecutionNotFoundError || error instanceof ExecutionCancelledError) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user