From: Jérôme Benoit Date: Sat, 6 May 2023 19:10:58 +0000 (+0200) Subject: docs: update changelog X-Git-Tag: v2.4.12~5 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;ds=sidebyside;h=0682ba158c6af9ffc453f38bd7d16438eab97695;hp=9d16d33ed1bd28d0ff17e278b6a26c9a4f1d1200;p=poolifier.git docs: update changelog Signed-off-by: Jérôme Benoit --- diff --git a/CHANGELOG.md b/CHANGELOG.md index c2a0b95f..6c56fd72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Use O(1) queue implementation for tasks queueing. +### Fixed + +- Fix median computation implementation. +- Fix fair share worker choice strategy internals update. + ## [2.4.11] - 2023-04-23 ### Changed diff --git a/src/pools/selection-strategies/abstract-worker-choice-strategy.ts b/src/pools/selection-strategies/abstract-worker-choice-strategy.ts index e2dd626d..bf67b80e 100644 --- a/src/pools/selection-strategies/abstract-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/abstract-worker-choice-strategy.ts @@ -124,9 +124,13 @@ export abstract class AbstractWorkerChoiceStrategy< // return this.workerNodes.findLastIndex(workerNode => { // return workerNode.tasksUsage.running === 0 // }) - for (let i = this.pool.workerNodes.length - 1; i >= 0; i--) { - if (this.pool.workerNodes[i].tasksUsage.running === 0) { - return i + for ( + let workerNodeKey = this.pool.workerNodes.length - 1; + workerNodeKey >= 0; + workerNodeKey-- + ) { + if (this.pool.workerNodes[workerNodeKey].tasksUsage.running === 0) { + return workerNodeKey } } return -1