X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Ftypescript%2Fwebsocket-server-pool%2Fws-cluster%2Fsrc%2Fmain.ts;h=34e2a58ba8e5fccd20da378cbbd69932bc9f47a1;hb=6bb2a64f78c7ba84e4d3690d18c2f8ca9e418069;hp=ad58bd20ccb8806f2954da84f46b82886f9dd71c;hpb=fef029a52aacd3063ba882834ce58527600009ca;p=poolifier.git diff --git a/examples/typescript/websocket-server-pool/ws-cluster/src/main.ts b/examples/typescript/websocket-server-pool/ws-cluster/src/main.ts index ad58bd20..34e2a58b 100644 --- a/examples/typescript/websocket-server-pool/ws-cluster/src/main.ts +++ b/examples/typescript/websocket-server-pool/ws-cluster/src/main.ts @@ -1,7 +1,9 @@ import { dirname, extname, join } from 'node:path' import { fileURLToPath } from 'node:url' -import { FixedClusterPool, availableParallelism } from 'poolifier' -import { type WorkerData, type WorkerResponse } from './types.js' + +import { availableParallelism, FixedClusterPool } from 'poolifier' + +import type { WorkerData, WorkerResponse } from './types.js' const workerFile = join( dirname(fileURLToPath(import.meta.url)), @@ -12,17 +14,17 @@ const pool = new FixedClusterPool( availableParallelism(), workerFile, { + enableEvents: false, onlineHandler: () => { pool .execute({ port: 8080 }) .then(response => { if (response.status) { console.info( - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `WebSocket server is listening in cluster worker on port ${response.port}` ) } - return null + return undefined }) .catch(error => { console.error(