From: Jérôme Benoit Date: Tue, 8 Jul 2025 17:28:17 +0000 (+0200) Subject: refactor: cleanup task function ops method X-Git-Tag: v5.0.6~3 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=62242b7d286af3251b00a48a90491ff1f4b1fac5;p=poolifier.git refactor: cleanup task function ops method Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 2d8255f92..088696b40 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -2316,9 +2316,9 @@ export abstract class AbstractPool< const taskFunctionOperationsListener = ( message: MessageValue, resolve: (value: boolean | PromiseLike) => void, - reject: (reason?: unknown) => void, - responsesReceived: MessageValue[] + reject: (reason?: unknown) => void ): void => { + const responsesReceived: MessageValue[] = [] this.checkMessageWorkerId(message) if ( message.taskFunctionOperationStatus != null && @@ -2351,14 +2351,8 @@ export abstract class AbstractPool< let listener: ((message: MessageValue) => void) | undefined try { return await new Promise((resolve, reject) => { - const responsesReceived: MessageValue[] = [] listener = (message: MessageValue) => { - taskFunctionOperationsListener( - message, - resolve, - reject, - responsesReceived - ) + taskFunctionOperationsListener(message, resolve, reject) } for (const workerNodeKey of targetWorkerNodeKeys) { this.registerWorkerMessageListener(workerNodeKey, listener)