From 0daacf51007efeffb390a028641f947a6e212803 Mon Sep 17 00:00:00 2001 From: alexghr Date: Tue, 10 Mar 2026 08:50:29 +0000 Subject: [PATCH] fix: orchestrator enqueue yield --- .../prover-client/src/orchestrator/orchestrator.ts | 9 ++++++--- yarn-project/stdlib/src/interfaces/prover-client.ts | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator.ts b/yarn-project/prover-client/src/orchestrator/orchestrator.ts index a038867350b2..1dd893fe6af6 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator.ts @@ -14,6 +14,7 @@ import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundatio import { promiseWithResolvers } from '@aztec/foundation/promise'; import { SerialQueue } from '@aztec/foundation/queue'; import { assertLength } from '@aztec/foundation/serialize'; +import { sleep } from '@aztec/foundation/sleep'; import { pushTestData } from '@aztec/foundation/testing'; import { elapsed } from '@aztec/foundation/timer'; import type { TreeNodeLocation } from '@aztec/foundation/trees'; @@ -634,9 +635,11 @@ export class ProvingOrchestrator implements EpochProver { } }; - // Enqueue onto the serial queue with limited workers to avoid starving the event loop. - // Workers yield between jobs via await, allowing I/O callbacks to process. - void this.deferredJobQueue.put(() => safeJob()); + void this.deferredJobQueue.put(async () => { + void safeJob(); + // we yield here to the macro task queue such to give Nodejs a chance to run other operatoins in between enqueues + await sleep(0); + }); } private async updateL1ToL2MessageTree(l1ToL2Messages: Fr[], db: MerkleTreeWriteOperations) { diff --git a/yarn-project/stdlib/src/interfaces/prover-client.ts b/yarn-project/stdlib/src/interfaces/prover-client.ts index 45a9c5b6e65f..941f816216c3 100644 --- a/yarn-project/stdlib/src/interfaces/prover-client.ts +++ b/yarn-project/stdlib/src/interfaces/prover-client.ts @@ -113,7 +113,7 @@ export const proverConfigMappings: ConfigMappingsType = { enqueueConcurrency: { env: 'PROVER_ENQUEUE_CONCURRENCY', description: 'Max concurrent jobs the orchestrator serializes and enqueues to the broker.', - ...numberConfigHelper(10), + ...numberConfigHelper(50), }, };