1 import { DynamicThreadPool
, FixedThreadPool
} from
'poolifier'
2 import { MyData
, MyResponse
} from
'./worker'
4 import { join
} from
'path'
6 export const fixedPool
= new FixedThreadPool
<MyData
, Promise
<MyResponse
>>(
8 join(__dirname
, 'worker.js'),
10 errorHandler
: e
=> console
.error(e
),
11 onlineHandler
: () => console
.log('Worker is online')
15 export const dynamicPool
= new DynamicThreadPool
<MyData
, Promise
<MyResponse
>>(
18 join(__dirname
, 'worker.js'),
20 errorHandler
: e
=> console
.error(e
),
21 onlineHandler
: () => console
.log('Worker is online')