From e9dd5b668e17caa64fe1e3e17f481b36a42dffb3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 13 Sep 2023 22:39:07 +0200 Subject: [PATCH] refactor: cleanup workerId usage left 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 | 3 +-- src/pools/cluster/fixed.ts | 3 +-- src/pools/thread/fixed.ts | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 6a26c7b7..eb517943 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -1248,8 +1248,7 @@ export abstract class AbstractPool< }) const workerInfo = this.getWorkerInfo(workerNodeKey) this.sendToWorker(workerNodeKey, { - checkActive: true, - workerId: workerInfo.id as number + checkActive: true }) if (this.taskFunctions.size > 0) { for (const [taskFunctionName, taskFunction] of this.taskFunctions) { diff --git a/src/pools/cluster/fixed.ts b/src/pools/cluster/fixed.ts index 20215df6..9470cccd 100644 --- a/src/pools/cluster/fixed.ts +++ b/src/pools/cluster/fixed.ts @@ -92,8 +92,7 @@ export class FixedClusterPool< /** @inheritDoc */ protected sendStartupMessageToWorker (workerNodeKey: number): void { this.sendToWorker(workerNodeKey, { - ready: false, - workerId: this.workerNodes[workerNodeKey].info.id as number + ready: false }) } diff --git a/src/pools/thread/fixed.ts b/src/pools/thread/fixed.ts index 51123204..2ad94a7b 100644 --- a/src/pools/thread/fixed.ts +++ b/src/pools/thread/fixed.ts @@ -90,10 +90,9 @@ export class FixedThreadPool< /** @inheritDoc */ protected sendStartupMessageToWorker (workerNodeKey: number): void { const workerNode = this.workerNodes[workerNodeKey] - const worker = workerNode.worker const port2: MessagePort = (workerNode.messageChannel as MessageChannel) .port2 - worker.postMessage( + workerNode.worker.postMessage( { ready: false, workerId: workerNode.info.id, -- 2.34.1