refactor: cleanup worker code
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 11 Dec 2023 13:13:33 +0000 (14:13 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 11 Dec 2023 13:13:33 +0000 (14:13 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/worker/abstract-worker.ts
src/worker/cluster-worker.ts
src/worker/thread-worker.ts

index 5fcc3419b2c1acc8d9ea39ca556c199a9ff44ea9..15259106cfe59e1e73d7ec3a613da27a262c62a8 100644 (file)
@@ -86,13 +86,11 @@ export abstract class AbstractWorker<
    * @param opts - Options for the worker.
    */
   public constructor (
-    type: string,
     protected readonly isMain: boolean,
     private readonly mainWorker: MainWorker,
     taskFunctions: TaskFunction<Data, Response> | TaskFunctions<Data, Response>,
     protected opts: WorkerOptions = DEFAULT_WORKER_OPTIONS
   ) {
-    // super(type)
     if (this.isMain == null) {
       throw new Error('isMain parameter is mandatory')
     }
index 0fd9095625fa7ab6bf4bd9203cbf9b4e2ef03348..cafef7fc076feb74a3153418939820efd53153fc 100644 (file)
@@ -32,13 +32,7 @@ export class ClusterWorker<
     taskFunctions: TaskFunction<Data, Response> | TaskFunctions<Data, Response>,
     opts: WorkerOptions = {}
   ) {
-    super(
-      'poolifier:cluster-worker',
-      cluster.isPrimary,
-      cluster.worker as Worker,
-      taskFunctions,
-      opts
-    )
+    super(cluster.isPrimary, cluster.worker as Worker, taskFunctions, opts)
   }
 
   /** @inheritDoc */
index d5ce3a2f130da3efbe81f0aa0e3b3e7394033822..fdbab44ed5f1356e6502a814f56e3a94ef54215d 100644 (file)
@@ -41,13 +41,7 @@ export class ThreadWorker<
     taskFunctions: TaskFunction<Data, Response> | TaskFunctions<Data, Response>,
     opts: WorkerOptions = {}
   ) {
-    super(
-      'poolifier:thread-worker',
-      isMainThread,
-      parentPort as MessagePort,
-      taskFunctions,
-      opts
-    )
+    super(isMainThread, parentPort as MessagePort, taskFunctions)
   }
 
   /** @inheritDoc */