X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fround-robin-worker-choice-strategy.ts;h=d2d6f6d6574a23b092da2323957b312deee13d4d;hb=a20f0ba5aa9c6946254aa197286ad9b70b6a0319;hp=80e958a406fa2209ce1c20eded5b8e9b79e9ca0b;hpb=027063571693f211b35c8851566a063201adb9af;p=poolifier.git diff --git a/src/pools/selection-strategies/round-robin-worker-choice-strategy.ts b/src/pools/selection-strategies/round-robin-worker-choice-strategy.ts index 80e958a4..d2d6f6d6 100644 --- a/src/pools/selection-strategies/round-robin-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/round-robin-worker-choice-strategy.ts @@ -1,6 +1,11 @@ +import { DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS } from '../../utils' +import type { IPool } from '../pool' import type { IWorker } from '../worker' import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy' -import type { IWorkerChoiceStrategy } from './selection-strategies-types' +import type { + IWorkerChoiceStrategy, + WorkerChoiceStrategyOptions +} from './selection-strategies-types' /** * Selects the next worker in a round robin fashion. @@ -21,6 +26,15 @@ export class RoundRobinWorkerChoiceStrategy< */ private nextWorkerNodeId: number = 0 + /** @inheritDoc */ + public constructor ( + pool: IPool, + opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS + ) { + super(pool, opts) + this.checkOptions(this.opts) + } + /** @inheritDoc */ public reset (): boolean { this.nextWorkerNodeId = 0