refactor: cleanup workerId usage left
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 13 Sep 2023 20:39:07 +0000 (22:39 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 13 Sep 2023 20:39:07 +0000 (22:39 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/pools/abstract-pool.ts
src/pools/cluster/fixed.ts
src/pools/thread/fixed.ts

index 6a26c7b7a63129c1d51e1bcfac0804b2d9962608..eb517943a6dc74b6ec88ca9cd17f4ca5c5eb5365 100644 (file)
@@ -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) {
index 20215df650c8ce6102d5ad9eaad3253a7c0ccf63..9470cccd857321388d70e0bf7f09de1a20505cfe 100644 (file)
@@ -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
     })
   }
 
index 51123204b8666ac4a1ef6c08b41d1ffdac1065bb..2ad94a7bf16083072bf1303745834c2b7c06506a 100644 (file)
@@ -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,