refactor: cleanup object destructuration in examples
[poolifier.git] / examples / typescript / websocket-server-pool / ws-hybrid / src / main.ts
index d9e827cbfa262f83613cb01c8201b70efdfec4a7..5cfbbf43e36e3f6fe0595bd9c1256cc8bcbf6f3e 100644 (file)
@@ -21,7 +21,10 @@ const pool = new FixedClusterPool<ClusterWorkerData, ClusterWorkerResponse>(
       pool
         .execute({
           port: 8080,
-          maxWorkers: Math.round(availableParallelism() / 2),
+          maxWorkers:
+            Math.round(availableParallelism() / 4) < 1
+              ? 1
+              : Math.round(availableParallelism() / 4),
           workerFile: requestHandlerWorkerFile,
           enableTasksQueue: true,
           tasksQueueOptions: {
@@ -31,7 +34,7 @@ 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
@@ -40,7 +43,7 @@ const pool = new FixedClusterPool<ClusterWorkerData, ClusterWorkerResponse>(
           }
           return null
         })
-        .catch(error => {
+        .catch((error) => {
           console.error(
             'WebSocket server failed to start in cluster worker:',
             error