repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge dependabot/npm_and_yarn/examples/typescript/http-server-pool/fastify-worker_thr...
[poolifier.git]
/
examples
/
typescript
/
http-server-pool
/
fastify-worker_threads
/
src
/
fastify-poolifier.ts
diff --git
a/examples/typescript/http-server-pool/fastify-worker_threads/src/fastify-poolifier.ts
b/examples/typescript/http-server-pool/fastify-worker_threads/src/fastify-poolifier.ts
index 15e5656b12abe44477a65dc7efd4a994b51663d7..aa9a6d1459813c6a4cf66f0d2ce9795db5b63288 100644
(file)
--- a/
examples/typescript/http-server-pool/fastify-worker_threads/src/fastify-poolifier.ts
+++ b/
examples/typescript/http-server-pool/fastify-worker_threads/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 { DynamicThreadPool, availableParallelism } from 'poolifier'
-import
{ type
FastifyPluginCallback } from 'fastify'
+import
type {
FastifyPluginCallback } from 'fastify'
import fp from 'fastify-plugin'
import {
type FastifyPoolifierOptions,
import fp from 'fastify-plugin'
import {
type FastifyPoolifierOptions,
@@
-20,11
+20,12
@@
const fastifyPoolifierPlugin: FastifyPluginCallback<FastifyPoolifierOptions> = (
},
...options
}
},
...options
}
+ const { workerFile, minWorkers, maxWorkers, ...poolOptions } = options
const pool = new DynamicThreadPool<WorkerData, WorkerResponse>(
const pool = new DynamicThreadPool<WorkerData, WorkerResponse>(
-
options.
minWorkers as number,
-
options.
maxWorkers as number,
-
options.
workerFile,
-
o
ptions
+ minWorkers as number,
+ maxWorkers as number,
+ workerFile,
+
poolO
ptions
)
if (!fastify.hasDecorator('pool')) {
fastify.decorate('pool', pool)
)
if (!fastify.hasDecorator('pool')) {
fastify.decorate('pool', pool)