From: Jérôme Benoit Date: Tue, 30 May 2023 10:44:00 +0000 (+0200) Subject: refactor: silence sonar X-Git-Tag: v2.5.0~9^2^2~7 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f8eb0a2ac2b5c65b09e1488f277237dd3268e552;p=poolifier.git refactor: silence sonar Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 2e769fc9..724785f5 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -430,13 +430,21 @@ export abstract class AbstractPool< worker: Worker, message: MessageValue ): void { - const workerNodeKey = this.getWorkerNodeKey(worker) - const workerTasksUsage = this.workerNodes[workerNodeKey].tasksUsage + const workerTasksUsage = + this.workerNodes[this.getWorkerNodeKey(worker)].tasksUsage --workerTasksUsage.running ++workerTasksUsage.run if (message.error != null) { ++workerTasksUsage.error } + this.updateRunTimeTasksUsage(workerTasksUsage, message) + this.updateWaitTasksUsage(workerTasksUsage, message) + } + + private updateRunTimeTasksUsage ( + workerTasksUsage: TasksUsage, + message: MessageValue + ): void { if (this.workerChoiceStrategyContext.getRequiredStatistics().runTime) { workerTasksUsage.runTime += message.runTime ?? 0 if ( @@ -454,6 +462,12 @@ export abstract class AbstractPool< workerTasksUsage.medRunTime = median(workerTasksUsage.runTimeHistory) } } + } + + private updateWaitTasksUsage ( + workerTasksUsage: TasksUsage, + message: MessageValue + ): void { if (this.workerChoiceStrategyContext.getRequiredStatistics().waitTime) { workerTasksUsage.waitTime += message.waitTime ?? 0 if (