Avoid to on-by-one in worker function. (#285)
[poolifier.git] / src / pools / cluster / fixed.ts
index b522947f25cb6f9497c7935fdcd131d1747e8b34..e1caf252332f7d0103a77a9470b1526a62613e78 100644 (file)
@@ -49,12 +49,14 @@ export class FixedClusterPool<
     super(numberOfWorkers, filePath, opts)
   }
 
+  /** @inheritdoc */
   protected setupHook (): void {
     setupMaster({
       exec: this.filePath
     })
   }
 
+  /** @inheritdoc */
   protected isMain (): boolean {
     return isMaster
   }
@@ -65,6 +67,7 @@ export class FixedClusterPool<
     worker.kill()
   }
 
+  /** @inheritdoc */
   protected sendToWorker (worker: Worker, message: MessageValue<Data>): void {
     worker.send(message)
   }
@@ -77,10 +80,12 @@ export class FixedClusterPool<
     worker.on('message', listener)
   }
 
+  /** @inheritdoc */
   protected createWorker (): Worker {
     return fork(this.opts.env)
   }
 
+  /** @inheritdoc */
   protected afterWorkerSetup (worker: Worker): void {
     // Listen worker messages.
     this.registerWorkerMessageListener(worker, super.workerListener())