chore: v3.0.5
[poolifier.git] / src / worker / cluster-worker.ts
index 1f9895d6e37b25a73911cd84f1c1f6f7404a98b8..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,
@@ -48,14 +48,12 @@ export class ClusterWorker<
         this.getMainWorker().on('message', this.messageListener.bind(this))
         this.sendToMainWorker({
           ready: true,
-          taskFunctionNames: this.listTaskFunctionNames(),
-          workerId: this.id
+          taskFunctionNames: this.listTaskFunctionNames()
         })
       } catch {
         this.sendToMainWorker({
           ready: false,
-          taskFunctionNames: this.listTaskFunctionNames(),
-          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 })
   }
 }