Merge pull request #67 from pioardi/dependabot/npm_and_yarn/standard-16.0.3
[poolifier.git] / examples / typescript / pool.ts
CommitLineData
e9e16250
CQ
1import { join } from "path";
2import { DynamicThreadPool, FixedThreadPool } from "poolifier";
3import { MyData, MyResponse } from "./worker";
4
5export const fixedPool = new FixedThreadPool<MyData, Promise<MyResponse>>(
6 8,
7 join(__dirname, "worker.js"),
8 {
9 errorHandler: (e) => console.error(e),
10 onlineHandler: () => console.log("Worker is online"),
11 }
12);
13
14export const dynamicPool = new DynamicThreadPool<MyData, Promise<MyResponse>>(
15 2,
16 8,
17 join(__dirname, "worker.js"),
18 {
19 errorHandler: (e) => console.error(e),
20 onlineHandler: () => console.log("Worker is online"),
21 }
22);