From: Jérôme Benoit Date: Fri, 14 Oct 2022 22:56:10 +0000 (+0200) Subject: WRR: Fix worker choice initial runtime value on each round X-Git-Tag: v2.3.2~7 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=d354916afe83118073287bcd405dcdf6f4cd9b20;p=poolifier.git WRR: Fix worker choice initial runtime value on each round Signed-off-by: Jérôme Benoit --- 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 aa751e54..4b1e5382 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 @@ -91,7 +91,11 @@ export class WeightedRoundRobinWorkerChoiceStrategy< this.currentWorkerIndex === this.pool.workers.length - 1 ? 0 : this.currentWorkerIndex + 1 - this.setWorkerTaskRunTime(chosenWorker, workerTaskWeight, 0) + this.setWorkerTaskRunTime( + this.pool.workers[this.currentWorkerIndex], + workerTaskWeight, + 0 + ) } return chosenWorker }