Merge pull request #879 from poolifier/dependabot/npm_and_yarn/examples/typescript...
[poolifier.git] / src / pools / thread / fixed.ts
index a193091f9fc7e1c4ac16c92a359eac470c0f6e78..32107e48635314e25269cc37e2c0ad7fdd3fcd75 100644 (file)
@@ -67,7 +67,7 @@ export class FixedThreadPool<
         resolve()
       })
     })
-    this.sendToWorker(workerNodeKey, { kill: true, workerId: worker.threadId })
+    await this.sendKillMessageToWorker(workerNodeKey, worker.threadId)
     workerNode.closeChannel()
     await worker.terminate()
     await waitWorkerExit
@@ -80,7 +80,7 @@ export class FixedThreadPool<
     transferList?: TransferListItem[]
   ): void {
     (
-      this.getWorkerInfo(workerNodeKey).messageChannel as MessageChannel
+      this.workerNodes[workerNodeKey].messageChannel as MessageChannel
     ).port1.postMessage(message, transferList)
   }
 
@@ -88,7 +88,7 @@ export class FixedThreadPool<
   protected sendStartupMessageToWorker (workerNodeKey: number): void {
     const worker = this.workerNodes[workerNodeKey].worker
     const port2: MessagePort = (
-      this.getWorkerInfo(workerNodeKey).messageChannel as MessageChannel
+      this.workerNodes[workerNodeKey].messageChannel as MessageChannel
     ).port2
     worker.postMessage(
       {
@@ -106,7 +106,7 @@ export class FixedThreadPool<
     listener: (message: MessageValue<Message>) => void
   ): void {
     (
-      this.getWorkerInfo(workerNodeKey).messageChannel as MessageChannel
+      this.workerNodes[workerNodeKey].messageChannel as MessageChannel
     ).port1.on('message', listener)
   }
 
@@ -128,16 +128,6 @@ export class FixedThreadPool<
     return WorkerTypes.thread
   }
 
-  /** @inheritDoc */
-  protected get minSize (): number {
-    return this.numberOfWorkers
-  }
-
-  /** @inheritDoc */
-  protected get maxSize (): number {
-    return this.numberOfWorkers
-  }
-
   /** @inheritDoc */
   protected get busy (): boolean {
     return this.internalBusy()