X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Ftypescript%2Fhttp-server-pool%2Ffastify-hybrid%2Fsrc%2Ffastify-poolifier.ts;h=f105d7af3a10395421b118e3ec308445ea0a63a4;hb=6a3ecc500583fc68d5bbce89f8448ccd022ab900;hp=2d13758028f8105f893226d91ed1c8ff07482949;hpb=aed302d456407817a368e3f743020474b60facd2;p=poolifier.git diff --git a/examples/typescript/http-server-pool/fastify-hybrid/src/fastify-poolifier.ts b/examples/typescript/http-server-pool/fastify-hybrid/src/fastify-poolifier.ts index 2d137580..f105d7af 100644 --- a/examples/typescript/http-server-pool/fastify-hybrid/src/fastify-poolifier.ts +++ b/examples/typescript/http-server-pool/fastify-hybrid/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 ThreadWorkerData, @@ -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?: ThreadWorkerData, name?: string, - transferList?: TransferListItem[] + transferList?: readonly TransferListItem[] ): Promise => await pool.execute(data, name, transferList) )