X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=examples%2Ftypescript%2Fhttp-server-pool%2Ffastify-hybrid%2Fsrc%2Ffastify-poolifier.ts;h=2d13758028f8105f893226d91ed1c8ff07482949;hb=8a11c8fd0b8be823629d0475ee16362b0bb31d25;hp=6e3a1dbfec643759ef30aecfd767e5f9d1c40e02;hpb=93b097acefb8dfea7259bff4cb9f6c337d34db94;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 6e3a1dbf..2d137580 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,4 +1,4 @@ -import type { TransferListItem } from 'worker_threads' +import type { TransferListItem } from 'node:worker_threads' import { DynamicThreadPool, availableParallelism } from 'poolifier' import { type FastifyPluginCallback } from 'fastify' import fp from 'fastify-plugin' @@ -20,11 +20,12 @@ const fastifyPoolifierPlugin: FastifyPluginCallback = ( }, ...options } + const { workerFile, minWorkers, maxWorkers, ...poolOptions } = options const pool = new DynamicThreadPool( - options.minWorkers as number, - options.maxWorkers as number, - options.workerFile, - options + minWorkers as number, + maxWorkers as number, + workerFile, + poolOptions ) if (!fastify.hasDecorator('pool')) { fastify.decorate('pool', pool)