X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fweighted-round-robin-worker-choice-strategy.ts;h=b023bfb0cd258641354c81c465c20fa9a3b0b309;hb=7790a494fdff6a2152b3153d02c9fbe8de11ed93;hp=c87081a6161c82ab612d5aca2b37a49e6b1089b0;hpb=226b02a3e2b3619cbe967634ccd6ac7b5d450147;p=poolifier.git diff --git a/src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts b/src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts index c87081a6..b023bfb0 100644 --- a/src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts @@ -81,6 +81,9 @@ export class WeightedRoundRobinWorkerChoiceStrategy< } if (this.nextWorkerNodeKey === workerNodeKey) { this.workerVirtualTaskRunTime = 0 + if (this.nextWorkerNodeKey > this.pool.workerNodes.length - 1) { + this.nextWorkerNodeKey = this.pool.workerNodes.length - 1 + } } if ( this.previousWorkerNodeKey === workerNodeKey &&