Merge dependabot/npm_and_yarn/examples/typescript/http-server-pool/fastify-worker_thr...
[poolifier.git] / src / worker / thread-worker.ts
index 6f36664b8ae1a56cebb5058d7d4c56885b5ae88f..d6a3699220b63fad5dc3191c1b4c1ca72d112bc8 100644 (file)
@@ -60,10 +60,17 @@ export class ThreadWorker<
       try {
         this.port = message.port
         this.port.on('message', this.messageListener.bind(this))
-        this.sendTaskFunctionsListToMainWorker()
-        this.sendToMainWorker({ ready: true, workerId: this.id })
+        this.sendToMainWorker({
+          ready: true,
+          taskFunctions: this.listTaskFunctions(),
+          workerId: this.id
+        })
       } catch {
-        this.sendToMainWorker({ ready: false, workerId: this.id })
+        this.sendToMainWorker({
+          ready: false,
+          taskFunctions: this.listTaskFunctions(),
+          workerId: this.id
+        })
       }
     }
   }
@@ -86,7 +93,7 @@ export class ThreadWorker<
   }
 
   /** @inheritDoc */
-  protected handleError (e: Error | string): string {
-    return e as string
+  protected handleError (error: Error | string): string {
+    return error as string
   }
 }