1 import { join
} from
'path'
2 import { DynamicThreadPool
, FixedThreadPool
} from
'poolifier'
3 import type { MyData
, MyResponse
} from
'./worker'
5 export const fixedPool
= new FixedThreadPool
<MyData
, Promise
<MyResponse
>>(
7 join(__dirname
, 'worker.js'),
9 errorHandler
: (e
: Error) => {
12 onlineHandler
: () => {
13 console
.log('Worker is online')
18 export const dynamicPool
= new DynamicThreadPool
<MyData
, Promise
<MyResponse
>>(
21 join(__dirname
, 'worker.js'),
23 errorHandler
: (e
: Error) => {
26 onlineHandler
: () => {
27 console
.log('Worker is online')