From a59e741b92e7cdb08833307b92e14bad571bf23e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 9 Oct 2022 23:41:21 +0200 Subject: [PATCH] Silence sonar MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../weighted-round-robin-choice-strategy.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pools/selection-strategies/weighted-round-robin-choice-strategy.ts b/src/pools/selection-strategies/weighted-round-robin-choice-strategy.ts index 0adc4ed4..db8fa235 100644 --- a/src/pools/selection-strategies/weighted-round-robin-choice-strategy.ts +++ b/src/pools/selection-strategies/weighted-round-robin-choice-strategy.ts @@ -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 -- 2.34.1