diff --git a/packages/cli/src/concurrency/concurrency-control.service.ts b/packages/cli/src/concurrency/concurrency-control.service.ts index 2849d19ae5526..1984148c292c3 100644 --- a/packages/cli/src/concurrency/concurrency-control.service.ts +++ b/packages/cli/src/concurrency/concurrency-control.service.ts @@ -99,7 +99,13 @@ export class ConcurrencyControlService { has(executionId: string) { if (!this.isEnabled) return false; - return Array.from(this.queues.values()).some((queue) => queue.getAll().has(executionId)); + for (const queue of this.queues.values()) { + if (queue.has(executionId)) { + return true; + } + } + + return false; } /** diff --git a/packages/cli/src/concurrency/concurrency-queue.ts b/packages/cli/src/concurrency/concurrency-queue.ts index 900018889aab8..eac9e478d106a 100644 --- a/packages/cli/src/concurrency/concurrency-queue.ts +++ b/packages/cli/src/concurrency/concurrency-queue.ts @@ -58,6 +58,10 @@ export class ConcurrencyQueue extends TypedEmitter { return new Set(this.queue.map((item) => item.executionId)); } + has(executionId: string) { + return this.queue.some((item) => item.executionId === executionId); + } + private resolveNext() { const item = this.queue.shift();