refactor: silence linter warning
[poolifier.git] / src / worker / cluster-worker.ts
index 35899e794f5b373aa5bca3ec5b3dbe2d1f5cd4c3..0fd9095625fa7ab6bf4bd9203cbf9b4e2ef03348 100644 (file)
@@ -33,7 +33,7 @@ export class ClusterWorker<
     opts: WorkerOptions = {}
   ) {
     super(
-      'worker-cluster-pool:poolifier',
+      'poolifier:cluster-worker',
       cluster.isPrimary,
       cluster.worker as Worker,
       taskFunctions,
@@ -45,17 +45,15 @@ export class ClusterWorker<
   protected handleReadyMessage (message: MessageValue<Data>): void {
     if (message.workerId === this.id && message.ready === false) {
       try {
-        this.getMainWorker()?.on('message', this.messageListener.bind(this))
+        this.getMainWorker().on('message', this.messageListener.bind(this))
         this.sendToMainWorker({
           ready: true,
-          taskFunctions: this.listTaskFunctions(),
-          workerId: this.id
+          taskFunctionNames: this.listTaskFunctionNames()
         })
       } catch {
         this.sendToMainWorker({
           ready: false,
-          taskFunctions: this.listTaskFunctions(),
-          workerId: this.id
+          taskFunctionNames: this.listTaskFunctionNames()
         })
       }
     }
@@ -68,6 +66,6 @@ export class ClusterWorker<
 
   /** @inheritDoc */
   protected sendToMainWorker (message: MessageValue<Response>): void {
-    this.getMainWorker().send(message)
+    this.getMainWorker().send({ ...message, workerId: this.id })
   }
 }