From: Jérôme Benoit Date: Tue, 21 Nov 2023 19:43:45 +0000 (+0100) Subject: fix: partially revert "fix: sort round weights descending in IWRR" X-Git-Tag: v3.0.6~12 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b808b62580605e507857b67330a7f5baced7810c;p=poolifier.git fix: partially revert "fix: sort round weights descending in IWRR" Signed-off-by: Jérôme Benoit --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e17cee6..60a03ae2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Ensure pool statuses are checked at initialization, `start()` or `destroy()`. -- Sort IWRR worker choice strategy round weights in descending order. ## [3.0.5] - 2023-10-27 diff --git a/docs/worker-choice-strategies.md b/docs/worker-choice-strategies.md index f7380dd6..36d6cf70 100644 --- a/docs/worker-choice-strategies.md +++ b/docs/worker-choice-strategies.md @@ -24,7 +24,7 @@ The worker weights are maximum tasks execution time. Once the worker has reached ### Interleaved weighted round robin (experimental) -The worker weights are maximum tasks execution time. The rounds are the deduplicated worker weights in descending order. +The worker weights are maximum tasks execution time. The rounds are the deduplicated worker weights in ascending order. During a round, if the worker weight is superior or equal to the current round weight and its tasks execution time is inferior to the current round weight, the task is assigned to the worker. Once all workers weight have been tested, the next round starts. The default worker weights is the same for each and computed given the CPU cores speed and theirs numbers. So the default 'rounds' consists of a unique worker weight. 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 9c863b56..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 @@ -170,7 +170,7 @@ export class InterleavedWeightedRoundRobinWorkerChoiceStrategy< ...new Set( Object.values(this.opts.weights) .slice() - .sort((a, b) => b - a) + .sort((a, b) => a - b) ) ] }