From 51af50ef7ad06da0f7d71c7985a251e48b97c434 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 17 Nov 2023 21:11:03 +0100 Subject: [PATCH] refactor: use object destructuration for task execution response MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/pools/abstract-pool.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index b09b81ae..94902356 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -1585,13 +1585,13 @@ export abstract class AbstractPool< const { taskId, workerError, data } = message const promiseResponse = this.promiseResponseMap.get(taskId as string) if (promiseResponse != null) { + const { resolve, reject, workerNodeKey } = promiseResponse if (workerError != null) { this.emitter?.emit(PoolEvents.taskError, workerError) - promiseResponse.reject(workerError.message) + reject(workerError.message) } else { - promiseResponse.resolve(data as Response) + resolve(data as Response) } - const workerNodeKey = promiseResponse.workerNodeKey this.afterTaskExecutionHook(workerNodeKey, message) this.workerChoiceStrategyContext.update(workerNodeKey) this.promiseResponseMap.delete(taskId as string) -- 2.34.1