+import { DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS } from '../../utils'
import type { IPoolInternal } from '../pool-internal'
import { PoolType } from '../pool-internal'
import type { IWorker } from '../worker'
*/
public constructor (
protected readonly pool: IPoolInternal<Worker, Data, Response>,
- protected readonly opts: WorkerChoiceStrategyOptions = { medRunTime: false }
+ protected readonly opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS
) {
- this.checkOptions()
+ this.checkOptions(this.opts)
this.isDynamicPool = this.pool.type === PoolType.DYNAMIC
this.choose.bind(this)
}
- private checkOptions (): void {
- if (this.requiredStatistics.avgRunTime && this.opts.medRunTime === true) {
+ private checkOptions (opts: WorkerChoiceStrategyOptions): void {
+ if (this.requiredStatistics.avgRunTime && opts.medRunTime === true) {
this.requiredStatistics.medRunTime = true
}
}