54b437ab31b2f1d7785439c5ce9007167e554331
1 import { join
} from
'path'
2 import type { MyData
, MyResponse
} from
'./worker'
9 export const fixedPool
= new FixedThreadPool
<MyData
, Promise
<MyResponse
>>(
10 availableParallelism(),
11 join(__dirname
, 'worker.js'),
13 errorHandler
: (e
: Error) => {
16 onlineHandler
: () => {
17 console
.info('Worker is online')
22 export const dynamicPool
= new DynamicThreadPool
<MyData
, Promise
<MyResponse
>>(
23 Math.floor(availableParallelism() / 2),
24 availableParallelism(),
25 join(__dirname
, 'worker.js'),
27 errorHandler
: (e
: Error) => {
30 onlineHandler
: () => {
31 console
.info('Worker is online')