De-duplicate code for workers (#154)
[poolifier.git] / src / pools / thread / fixed.ts
index ee3d63c12c7abe8c1583a56baa169d3a83afcbca..bfd6f016d0d4f08525d1c19435d4a138e2a404a0 100644 (file)
@@ -48,7 +48,6 @@ export class FixedThreadPool<
     worker: ThreadWorkerWithMessageChannel
   ): Promise<void> {
     await worker.terminate()
-    // FIXME: The tests are currently failing, so these must be changed first
   }
 
   protected sendToWorker (
@@ -72,15 +71,13 @@ export class FixedThreadPool<
     port.port2?.removeListener('message', listener)
   }
 
-  protected newWorker (): ThreadWorkerWithMessageChannel {
+  protected createWorker (): ThreadWorkerWithMessageChannel {
     return new Worker(this.filePath, {
       env: SHARE_ENV
     })
   }
 
-  protected afterNewWorkerPushed (
-    worker: ThreadWorkerWithMessageChannel
-  ): void {
+  protected afterWorkerSetup (worker: ThreadWorkerWithMessageChannel): void {
     const { port1, port2 } = new MessageChannel()
     worker.postMessage({ parent: port1 }, [port1])
     worker.port1 = port1