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/express-cluster...
[poolifier.git]
/
examples
/
typescript
/
http-client-pool
/
src
/
pool.ts
diff --git
a/examples/typescript/http-client-pool/src/pool.ts
b/examples/typescript/http-client-pool/src/pool.ts
index 139f3fb963e4fdfd454efc9de79fede213deacbb..3d64150a8af14c161c4a005a044ad2b003bacad0 100644
(file)
--- a/
examples/typescript/http-client-pool/src/pool.ts
+++ b/
examples/typescript/http-client-pool/src/pool.ts
@@
-1,6
+1,6
@@
import { fileURLToPath } from 'node:url'
import { dirname, extname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { dirname, extname, join } from 'node:path'
-import {
Fixed
ThreadPool, availableParallelism } from 'poolifier'
+import {
Dynamic
ThreadPool, availableParallelism } from 'poolifier'
import { type WorkerData, type WorkerResponse } from './types.js'
const workerFile = join(
import { type WorkerData, type WorkerResponse } from './types.js'
const workerFile = join(
@@
-8,7
+8,8
@@
const workerFile = join(
`worker${extname(fileURLToPath(import.meta.url))}`
)
`worker${extname(fileURLToPath(import.meta.url))}`
)
-export const httpClientPool = new FixedThreadPool<WorkerData, WorkerResponse>(
+export const httpClientPool = new DynamicThreadPool<WorkerData, WorkerResponse>(
+ 1,
availableParallelism(),
workerFile,
{
availableParallelism(),
workerFile,
{
@@
-17,7
+18,7
@@
export const httpClientPool = new FixedThreadPool<WorkerData, WorkerResponse>(
concurrency: 8
},
errorHandler: (e: Error) => {
concurrency: 8
},
errorHandler: (e: Error) => {
- console.error(e)
+ console.error(
'Thread worker error:',
e)
}
}
)
}
}
)