X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Finterleaved-weighted-round-robin-worker-choice-strategy.ts;h=eee39ec8d646da13324c7050e86afc33882fa22c;hb=55d7d6002049be09a06b08da26febe2e8bfa494b;hp=15a6c7f48eaac7f0a81e5a30bfd74762a426435d;hpb=97256a852ff3c5a6f85542fe749b831a8c600e30;p=poolifier.git diff --git a/src/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.ts b/src/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.ts index 15a6c7f4..eee39ec8 100644 --- a/src/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.ts @@ -122,20 +122,18 @@ export class InterleavedWeightedRoundRobinWorkerChoiceStrategy< } private interleavedWeightedRoundRobinNextWorkerNodeId (): void { - do { - if ( - this.roundId === this.roundWeights.length - 1 && - this.workerNodeId === this.pool.workerNodes.length - 1 - ) { - this.roundId = 0 - this.workerNodeId = 0 - } else if (this.workerNodeId === this.pool.workerNodes.length - 1) { - this.roundId = this.roundId + 1 - this.workerNodeId = 0 - } else { - this.workerNodeId = this.workerNodeId + 1 - } - } while (!this.isWorkerNodeReady(this.workerNodeId)) + if ( + this.roundId === this.roundWeights.length - 1 && + this.workerNodeId === this.pool.workerNodes.length - 1 + ) { + this.roundId = 0 + this.workerNodeId = 0 + } else if (this.workerNodeId === this.pool.workerNodes.length - 1) { + this.roundId = this.roundId + 1 + this.workerNodeId = 0 + } else { + this.workerNodeId = this.workerNodeId + 1 + } } /** @inheritDoc */