- constructor(workerScript: string, min: number, max: number, workerStartDelay?: number, opts?: PoolOptions<Worker>) {
- super(workerScript, workerStartDelay);
- opts.exitHandler = opts?.exitHandler ?? WorkerUtils.defaultExitHandler;
- this.pool = new DynamicThreadPool<WorkerData>(min, max, this.workerScript, opts);
+ constructor(workerScript: string, workerOptions?: WorkerOptions) {
+ super(workerScript, workerOptions);
+ this.workerOptions.poolOptions.exitHandler =
+ this.workerOptions?.poolOptions?.exitHandler ?? WorkerUtils.defaultExitHandler;
+ this.pool = new DynamicThreadPool<WorkerData>(
+ this.workerOptions.poolMinSize,
+ this.workerOptions.poolMaxSize,
+ this.workerScript,
+ this.workerOptions.poolOptions
+ );