From d354916afe83118073287bcd405dcdf6f4cd9b20 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 15 Oct 2022 00:56:10 +0200 Subject: [PATCH] WRR: Fix worker choice initial runtime value on each round MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../weighted-round-robin-worker-choice-strategy.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 } -- 2.34.1