X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Ftypescript%2Fwebsocket-server-pool%2Fws-hybrid%2Fsrc%2Fmain.ts;h=f6536bd0bbc3bbde78e8cd5bf68cfb48099e1fc6;hb=a4a08eb3c7a039293596552e67e4b36125267321;hp=b9e48bdd2ee194abf47d6d1b69eddd3dc134100d;hpb=4cc21109c903c61da22760c3799f6b7bf72f2cf2;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 b9e48bdd..f6536bd0 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() / 4), + 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