perf(core): Introduce concurrency control for main mode (#9453)

This commit is contained in:
Iván Ovejero
2024-06-12 15:05:43 +02:00
committed by GitHub
parent 6c1a4c8ebf
commit 797342343f
31 changed files with 919 additions and 57 deletions

View File

@@ -6,6 +6,8 @@ import { createDeferredPromise } from 'n8n-workflow';
import type { IWorkflowExecutionDataProcess } from '@/Interfaces';
import type { ExecutionRepository } from '@db/repositories/execution.repository';
import { mock } from 'jest-mock-extended';
import { ConcurrencyControlService } from '@/concurrency/concurrency-control.service';
import { mockInstance } from '@test/mocking';
const FAKE_EXECUTION_ID = '15';
const FAKE_SECOND_EXECUTION_ID = '20';
@@ -18,11 +20,13 @@ const executionRepository = mock<ExecutionRepository>({
createNewExecution,
});
const concurrencyControl = mockInstance(ConcurrencyControlService, { isEnabled: false });
describe('ActiveExecutions', () => {
let activeExecutions: ActiveExecutions;
beforeEach(() => {
activeExecutions = new ActiveExecutions(mock(), executionRepository);
activeExecutions = new ActiveExecutions(mock(), executionRepository, concurrencyControl);
});
afterEach(() => {