X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Ftypescript%2Fwebsocket-server-pool%2Fws-hybrid%2Fsrc%2Fmain.ts;h=5cfbbf43e36e3f6fe0595bd9c1256cc8bcbf6f3e;hb=e53767e8c8bf547fc75769efe1a36232616c903b;hp=d9e827cbfa262f83613cb01c8201b70efdfec4a7;hpb=63ff88a9d5c789fe23036c1fed24e5d3853d2969;p=poolifier.git diff --git a/examples/typescript/websocket-server-pool/ws-hybrid/src/main.ts b/examples/typescript/websocket-server-pool/ws-hybrid/src/main.ts index d9e827cb..5cfbbf43 100644 --- a/examples/typescript/websocket-server-pool/ws-hybrid/src/main.ts +++ b/examples/typescript/websocket-server-pool/ws-hybrid/src/main.ts @@ -21,7 +21,10 @@ const pool = new FixedClusterPool( 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( 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( } return null }) - .catch(error => { + .catch((error) => { console.error( 'WebSocket server failed to start in cluster worker:', error