X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Ftypescript%2Fhttp-server-pool%2Ffastify-hybrid%2Fsrc%2Ffastify-poolifier.ts;h=2bdf2040bbbb3354ea1d703318ca3832ba109904;hb=cf02ff9e146e22a2f99a6af35de7ce49efd4c6b5;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..2bdf2040 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,6 +1,6 @@ -import type { TransferListItem } from 'worker_threads' +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 { type FastifyPoolifierOptions, @@ -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)