X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Ftypescript%2Fhttp-server-pool%2Fexpress-hybrid%2Fsrc%2Fmain.ts;h=69a329b6a9b3613b6da047af2786698f7e1134aa;hb=b01ef5473956a4393acd7602d8b9c9666d0347be;hp=838c6e26ed448959a22129b5435482bce7476a25;hpb=d0ed34c9a6f9896c16b1b963e87217bbf75f3393;p=poolifier.git diff --git a/examples/typescript/http-server-pool/express-hybrid/src/main.ts b/examples/typescript/http-server-pool/express-hybrid/src/main.ts index 838c6e26..69a329b6 100644 --- a/examples/typescript/http-server-pool/express-hybrid/src/main.ts +++ b/examples/typescript/http-server-pool/express-hybrid/src/main.ts @@ -1,6 +1,8 @@ import { dirname, extname, join } from 'node:path' import { fileURLToPath } from 'node:url' -import { FixedClusterPool, availableParallelism } from 'poolifier' + +import { availableParallelism, FixedClusterPool } from 'poolifier' + import type { ClusterWorkerData, ClusterWorkerResponse } from './types.js' const expressWorkerFile = join( @@ -17,6 +19,7 @@ const pool = new FixedClusterPool( availableParallelism(), expressWorkerFile, { + enableEvents: false, onlineHandler: () => { pool .execute({ @@ -34,16 +37,15 @@ 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 - `Express is listening in cluster worker on port ${response?.port}` + `Express is listening in cluster worker on port ${response.port}` ) } - return null + return undefined }) - .catch((error) => { + .catch((error: unknown) => { console.error('Express failed to start in cluster worker:', error) }) },