X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Ftypescript%2Fhttp-server-pool%2Ffastify-worker_threads%2Fsrc%2Ffastify-poolifier.ts;h=450a2aeaf2c7fda086aa19d117c5af5c20636ed2;hb=4a6ebc420a17984b9425d22802daaf7a2a778c83;hp=74c0c1687a7ee3dd586e570f7968f623f84d42c7;hpb=624e51e36eb773aa325fa03df96bce20761ab65b;p=poolifier.git diff --git a/examples/typescript/http-server-pool/fastify-worker_threads/src/fastify-poolifier.ts b/examples/typescript/http-server-pool/fastify-worker_threads/src/fastify-poolifier.ts index 74c0c168..450a2aea 100644 --- a/examples/typescript/http-server-pool/fastify-worker_threads/src/fastify-poolifier.ts +++ b/examples/typescript/http-server-pool/fastify-worker_threads/src/fastify-poolifier.ts @@ -1,7 +1,9 @@ import type { TransferListItem } from 'node:worker_threads' -import { DynamicThreadPool, availableParallelism } from 'poolifier' -import { type FastifyPluginCallback } from 'fastify' + +import type { FastifyPluginCallback } from 'fastify' import fp from 'fastify-plugin' +import { availableParallelism, DynamicThreadPool } from 'poolifier' + import { type FastifyPoolifierOptions, type WorkerData, @@ -22,8 +24,8 @@ const fastifyPoolifierPlugin: FastifyPluginCallback = ( } const { workerFile, minWorkers, maxWorkers, ...poolOptions } = options const pool = new DynamicThreadPool( - minWorkers as number, - maxWorkers as number, + minWorkers!, + maxWorkers!, workerFile, poolOptions ) @@ -36,7 +38,7 @@ const fastifyPoolifierPlugin: FastifyPluginCallback = ( async ( data?: WorkerData, name?: string, - transferList?: TransferListItem[] + transferList?: readonly TransferListItem[] ): Promise => await pool.execute(data, name, transferList) ) }