diff --git a/packages/cli/src/commands/start.ts b/packages/cli/src/commands/start.ts index 62762adbb85db..42431556400c8 100644 --- a/packages/cli/src/commands/start.ts +++ b/packages/cli/src/commands/start.ts @@ -27,10 +27,6 @@ import { ExecutionRepository } from '@db/repositories/execution.repository'; import { FeatureNotLicensedError } from '@/errors/feature-not-licensed.error'; import { WaitTracker } from '@/WaitTracker'; import { BaseCommand } from './BaseCommand'; -import type { IWorkflowExecutionDataProcess } from '@/Interfaces'; -import { ExecutionService } from '@/executions/execution.service'; -import { OwnershipService } from '@/services/ownership.service'; -import { WorkflowRunner } from '@/WorkflowRunner'; import { ExecutionRecoveryService } from '@/executions/execution-recovery.service'; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires @@ -300,10 +296,6 @@ export class Start extends BaseCommand { Container.get(PruningService).init(); Container.get(ExecutionRecoveryService).init(); - if (config.getEnv('executions.mode') === 'regular') { - await this.runEnqueuedExecutions(); - } - // Start to get active workflows and run their triggers await this.activeWorkflowManager.init(); @@ -345,38 +337,4 @@ export class Start extends BaseCommand { if (error.stack) this.logger.error(error.stack); await this.exitWithCrash('Exiting due to an error.', error); } - - /** - * During startup, we may find executions that had been enqueued at the time of shutdown. - * - * If so, start running any such executions concurrently up to the concurrency limit, and - * enqueue any remaining ones until we have spare concurrency capacity again. - */ - private async runEnqueuedExecutions() { - const executions = await Container.get(ExecutionService).findAllEnqueuedExecutions(); - - if (executions.length === 0) return; - - this.logger.debug( - '[Startup] Found enqueued executions to run', - executions.map((e) => e.id), - ); - - const ownershipService = Container.get(OwnershipService); - const workflowRunner = Container.get(WorkflowRunner); - - for (const execution of executions) { - const project = await ownershipService.getWorkflowProjectCached(execution.workflowId); - - const data: IWorkflowExecutionDataProcess = { - executionMode: execution.mode, - executionData: execution.data, - workflowData: execution.workflowData, - projectId: project.id, - }; - - // do not block - each execution either runs concurrently or is queued - void workflowRunner.run(data, undefined, false, execution.id); - } - } } diff --git a/packages/cli/src/executions/execution.service.ts b/packages/cli/src/executions/execution.service.ts index 546443ec4afca..21109dc125b85 100644 --- a/packages/cli/src/executions/execution.service.ts +++ b/packages/cli/src/executions/execution.service.ts @@ -390,17 +390,6 @@ export class ExecutionService { }; } - async findAllEnqueuedExecutions() { - return await this.executionRepository.findMultipleExecutions( - { - select: ['id', 'mode'], - where: { status: 'new' }, - order: { id: 'ASC' }, - }, - { includeData: true, unflattenData: true }, - ); - } - async stop(executionId: string): Promise { const execution = await this.executionRepository.findSingleExecution(executionId, { includeData: true,