build(deps-dev): apply updates
[poolifier.git] / examples / typescript / http-server-pool / fastify-hybrid / src / main.ts
index 5fc7542b7779df64a0f0aeab87ecc1ac13220246..d9a0015c637d528703902440ec0e986d5cc86450 100644 (file)
@@ -17,12 +17,16 @@ const pool = new FixedClusterPool<ClusterWorkerData, ClusterWorkerResponse>(
   Math.round(availableParallelism() / 2),
   fastifyWorkerFile,
   {
+    enableEvents: false,
     onlineHandler: () => {
       pool
         .execute({
           port: 8080,
           workerFile: requestHandlerWorkerFile,
-          maxWorkers: Math.round(availableParallelism() / 4),
+          maxWorkers:
+            Math.round(availableParallelism() / 4) < 1
+              ? 1
+              : Math.round(availableParallelism() / 4),
           enableTasksQueue: true,
           tasksQueueOptions: {
             concurrency: 8
@@ -31,16 +35,16 @@ const pool = new FixedClusterPool<ClusterWorkerData, ClusterWorkerResponse>(
             console.error('Thread worker error', e)
           }
         })
-        .then((response) => {
+        .then(response => {
           if (response.status) {
             console.info(
               // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
               `Fastify is listening in cluster worker on port ${response.port}`
             )
           }
-          return null
+          return undefined
         })
-        .catch((error) => {
+        .catch(error => {
           console.error('Fastify failed to start in cluster worker:', error)
         })
     },