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-hybrid
/
src
/
fastify-poolifier.ts
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 2a22fdcc6f57372a81fbe9d34ec3732deb75f0ab..2bdf2040bbbb3354ea1d703318ca3832ba109904 100644
(file)
--- 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 { 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<ThreadWorkerData, ThreadWorkerResponse>(
const pool = new DynamicThreadPool<ThreadWorkerData, ThreadWorkerResponse>(
-
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)
@@
-40,11
+41,6
@@
const fastifyPoolifierPlugin: FastifyPluginCallback<FastifyPoolifierOptions> = (
await pool.execute(data, name, transferList)
)
}
await pool.execute(data, name, transferList)
)
}
- if (!fastify.hasDecorator('listTaskFunctions')) {
- fastify.decorate('listTaskFunctions', (): string[] =>
- pool.listTaskFunctions()
- )
- }
done()
}
done()
}