refactor(core): Centralize scaling mode (no-changelog) (#9835)
This commit is contained in:
@@ -24,7 +24,7 @@ import type {
|
||||
IWorkflowExecutionDataProcess,
|
||||
} from '@/Interfaces';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import { Queue } from '@/Queue';
|
||||
import { ScalingService } from '@/scaling/scaling.service';
|
||||
import type { ExecutionRequest, ExecutionSummaries, StopResult } from './execution.types';
|
||||
import { WorkflowRunner } from '@/WorkflowRunner';
|
||||
import type { IGetExecutionsQueryFilter } from '@db/repositories/execution.repository';
|
||||
@@ -85,7 +85,7 @@ export class ExecutionService {
|
||||
constructor(
|
||||
private readonly globalConfig: GlobalConfig,
|
||||
private readonly logger: Logger,
|
||||
private readonly queue: Queue,
|
||||
private readonly scalingService: ScalingService,
|
||||
private readonly activeExecutions: ActiveExecutions,
|
||||
private readonly executionRepository: ExecutionRepository,
|
||||
private readonly workflowRepository: WorkflowRepository,
|
||||
@@ -471,10 +471,12 @@ export class ExecutionService {
|
||||
this.waitTracker.stopExecution(execution.id);
|
||||
}
|
||||
|
||||
const job = await this.queue.findRunningJobBy({ executionId: execution.id });
|
||||
const jobs = await this.scalingService.findJobsByStatus(['active', 'waiting']);
|
||||
|
||||
const job = jobs.find(({ data }) => data.executionId === execution.id);
|
||||
|
||||
if (job) {
|
||||
await this.queue.stopJob(job);
|
||||
await this.scalingService.stopJob(job);
|
||||
} else {
|
||||
this.logger.debug('Job to stop not in queue', { executionId: execution.id });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user