-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'
},
...options
}
+ const { workerFile, minWorkers, maxWorkers, ...poolOptions } = options
const pool = new DynamicThreadPool<WorkerData, WorkerResponse>(
- 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)