Silence sonar
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 9 Oct 2022 21:41:21 +0000 (23:41 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 9 Oct 2022 21:41:21 +0000 (23:41 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/pools/selection-strategies/weighted-round-robin-choice-strategy.ts

index 0adc4ed430232604e43a29aed4ef7dd5657cf2d3..db8fa235a8654f1c94b7e6f4c7e85ffdc82778f9 100644 (file)
@@ -101,10 +101,10 @@ export class WeightedRoundRobinWorkerChoiceStrategy<
 
   private computeWorkerWeight () {
     let cpusCycleTimeWeight = 0
-    for (let cpu = 0; cpu < cpus().length; cpu++) {
+    for (const cpu of cpus()) {
       // CPU estimated cycle time
-      const numberOfDigit = cpus()[cpu].speed.toString().length - 1
-      const cpuCycleTime = 1 / (cpus()[cpu].speed / Math.pow(10, numberOfDigit))
+      const numberOfDigit = cpu.speed.toString().length - 1
+      const cpuCycleTime = 1 / (cpu.speed / Math.pow(10, numberOfDigit))
       cpusCycleTimeWeight += cpuCycleTime * Math.pow(10, numberOfDigit)
     }
     return cpusCycleTimeWeight / cpus().length