docs: update changelog
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 6 May 2023 19:10:58 +0000 (21:10 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 6 May 2023 19:10:58 +0000 (21:10 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
CHANGELOG.md
src/pools/selection-strategies/abstract-worker-choice-strategy.ts

index c2a0b95f4659dd589b3b3b089ad2c998b8ba00a5..6c56fd72386c305e5e50f7041e6a31314f9af88a 100644 (file)
@@ -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
index e2dd626de76106991b11d1567d70c9e6f3d21ab7..bf67b80e84ef257bd8d10ffe86946a53b2433b8a 100644 (file)
@@ -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