Merge dependabot/npm_and_yarn/examples/typescript/http-server-pool/fastify-cluster...
[poolifier.git] / examples / typescript / http-server-pool / fastify-hybrid / src / fastify-poolifier.ts
index 6e3a1dbfec643759ef30aecfd767e5f9d1c40e02..2d13758028f8105f893226d91ed1c8ff07482949 100644 (file)
@@ -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<FastifyPoolifierOptions> = (
     },
     ...options
   }
+  const { workerFile, minWorkers, maxWorkers, ...poolOptions } = options
   const pool = new DynamicThreadPool<ThreadWorkerData, ThreadWorkerResponse>(
-    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)