From: Jérôme Benoit Date: Wed, 16 Aug 2023 15:38:54 +0000 (+0200) Subject: fix: fix possible null property exception in examples X-Git-Tag: v2.6.28~5 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1fa0cdf5c1471f14c09c7a33131f14f13215996b;p=poolifier.git fix: fix possible null property exception in examples Signed-off-by: Jérôme Benoit --- diff --git a/examples/typescript/http-server-pool/express-hybrid/src/express-worker.ts b/examples/typescript/http-server-pool/express-hybrid/src/express-worker.ts index 56fad6d1..901c2072 100644 --- a/examples/typescript/http-server-pool/express-hybrid/src/express-worker.ts +++ b/examples/typescript/http-server-pool/express-hybrid/src/express-worker.ts @@ -71,14 +71,12 @@ ClusterWorkerResponse ExpressWorker.server = application.listen(port, () => { console.info( // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - `⚡️[express server]: Express server is started in cluster worker at http://localhost:${workerData?.port}/` + `⚡️[express server]: Express server is started in cluster worker at http://localhost:${port}/` ) }) return { status: true, - port: - (ExpressWorker.server.address() as AddressInfo)?.port ?? - workerData?.port + port: (ExpressWorker.server.address() as AddressInfo)?.port ?? port } } diff --git a/examples/typescript/http-server-pool/fastify-cluster/src/worker.ts b/examples/typescript/http-server-pool/fastify-cluster/src/worker.ts index d70b76dd..283a223e 100644 --- a/examples/typescript/http-server-pool/fastify-cluster/src/worker.ts +++ b/examples/typescript/http-server-pool/fastify-cluster/src/worker.ts @@ -36,7 +36,7 @@ class FastifyWorker extends ClusterWorker { await FastifyWorker.fastify.listen({ port }) return { status: true, - port: (FastifyWorker.fastify.server.address() as AddressInfo).port + port: (FastifyWorker.fastify.server.address() as AddressInfo)?.port } } diff --git a/examples/typescript/http-server-pool/fastify-hybrid/src/fastify-worker.ts b/examples/typescript/http-server-pool/fastify-hybrid/src/fastify-worker.ts index e21eb58c..0566ee01 100644 --- a/examples/typescript/http-server-pool/fastify-hybrid/src/fastify-worker.ts +++ b/examples/typescript/http-server-pool/fastify-hybrid/src/fastify-worker.ts @@ -42,7 +42,7 @@ ClusterWorkerResponse await FastifyWorker.fastify.listen({ port }) return { status: true, - port: (FastifyWorker.fastify.server.address() as AddressInfo).port + port: (FastifyWorker.fastify.server.address() as AddressInfo)?.port } }