From: Jérôme Benoit Date: Sun, 9 Oct 2022 21:41:21 +0000 (+0200) Subject: Silence sonar X-Git-Tag: v2.3.1~51 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a59e741b92e7cdb08833307b92e14bad571bf23e;p=poolifier.git Silence sonar Signed-off-by: Jérôme Benoit --- 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