X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fround-robin-worker-choice-strategy.ts;h=be4fe3326b9585c8bd4f7261023cda4fe5af710e;hb=49be33feded000ed776ee589274e154fa519b263;hp=d2d6f6d6574a23b092da2323957b312deee13d4d;hpb=a20f0ba5aa9c6946254aa197286ad9b70b6a0319;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 d2d6f6d6..be4fe332 100644 --- a/src/pools/selection-strategies/round-robin-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/round-robin-worker-choice-strategy.ts @@ -32,7 +32,7 @@ export class RoundRobinWorkerChoiceStrategy< opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS ) { super(pool, opts) - this.checkOptions(this.opts) + this.setRequiredStatistics(this.opts) } /** @inheritDoc */ @@ -41,6 +41,11 @@ export class RoundRobinWorkerChoiceStrategy< return true } + /** @inheritDoc */ + public update (): boolean { + return true + } + /** @inheritDoc */ public choose (): number { const chosenWorkerNodeKey = this.nextWorkerNodeId @@ -56,11 +61,8 @@ export class RoundRobinWorkerChoiceStrategy< if (this.nextWorkerNodeId === workerNodeKey) { if (this.pool.workerNodes.length === 0) { this.nextWorkerNodeId = 0 - } else { - this.nextWorkerNodeId = - this.nextWorkerNodeId > this.pool.workerNodes.length - 1 - ? this.pool.workerNodes.length - 1 - : this.nextWorkerNodeId + } else if (this.nextWorkerNodeId > this.pool.workerNodes.length - 1) { + this.nextWorkerNodeId = this.pool.workerNodes.length - 1 } } return true