fix: fix build after merge with main
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 8 Jun 2023 18:03:38 +0000 (20:03 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 8 Jun 2023 18:03:38 +0000 (20:03 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/pools/selection-strategies/least-elu-worker-choice-strategy.ts
tests/pools/selection-strategies/selection-strategies.test.js

index f58e3b509e07bdb9de8e6782613bf4207d77674b..41ebf7fb4c5a47d241410aa28cf52d9c4ae44d23 100644 (file)
@@ -54,15 +54,15 @@ export class LeastEluWorkerChoiceStrategy<
 
   /** @inheritDoc */
   public choose (): number {
-    let minTasksElu = Infinity
+    let minWorkerElu = Infinity
     let leastEluWorkerNodeKey!: number
     for (const [workerNodeKey, workerNode] of this.pool.workerNodes.entries()) {
-      const tasksUsage = workerNode.tasksUsage
-      const tasksElu = tasksUsage.elu?.utilization ?? 0
-      if (tasksElu === 0) {
+      const workerUsage = workerNode.workerUsage
+      const workerElu = workerUsage.elu?.utilization ?? 0
+      if (workerElu === 0) {
         return workerNodeKey
-      } else if (tasksElu < minTasksElu) {
-        minTasksElu = tasksElu
+      } else if (workerElu < minWorkerElu) {
+        minWorkerElu = workerElu
         leastEluWorkerNodeKey = workerNodeKey
       }
     }
index 62e2e5220abbb936df71809787486ad27fbb4720..24a35810bb3d3327b07cf48b38317dfba9b51a20 100644 (file)
@@ -14,6 +14,7 @@ describe('Selection strategies test suite', () => {
   it('Verify that WorkerChoiceStrategies enumeration provides string values', () => {
     expect(WorkerChoiceStrategies.ROUND_ROBIN).toBe('ROUND_ROBIN')
     expect(WorkerChoiceStrategies.LEAST_USED).toBe('LEAST_USED')
+    expect(WorkerChoiceStrategies.LEAST_ELU).toBe('LEAST_ELU')
     expect(WorkerChoiceStrategies.LEAST_BUSY).toBe('LEAST_BUSY')
     expect(WorkerChoiceStrategies.FAIR_SHARE).toBe('FAIR_SHARE')
     expect(WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN).toBe(