From: Jérôme Benoit Date: Tue, 4 Jul 2023 20:22:27 +0000 (+0200) Subject: refactor: safer Math.{min,max} usage X-Git-Tag: v2.6.9~15 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=23e4439f22bcbb15e329ab24b6dfbfd7d415dba5;p=poolifier.git refactor: safer Math.{min,max} usage Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index e12023f1..bfd0268a 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -590,11 +590,11 @@ export abstract class AbstractPool< workerUsage.runTime.aggregate += taskRunTime workerUsage.runTime.minimum = Math.min( taskRunTime, - workerUsage.runTime.minimum + workerUsage.runTime.minimum ?? Infinity ) workerUsage.runTime.maximum = Math.max( taskRunTime, - workerUsage.runTime.maximum + workerUsage.runTime.maximum ?? -Infinity ) if ( this.workerChoiceStrategyContext.getTaskStatisticsRequirements().runTime @@ -629,11 +629,11 @@ export abstract class AbstractPool< workerUsage.waitTime.aggregate += taskWaitTime workerUsage.waitTime.minimum = Math.min( taskWaitTime, - workerUsage.waitTime.minimum + workerUsage.waitTime.minimum ?? Infinity ) workerUsage.waitTime.maximum = Math.max( taskWaitTime, - workerUsage.waitTime.maximum + workerUsage.waitTime.maximum ?? -Infinity ) if ( this.workerChoiceStrategyContext.getTaskStatisticsRequirements() @@ -676,19 +676,19 @@ export abstract class AbstractPool< } workerUsage.elu.idle.minimum = Math.min( message.taskPerformance.elu.idle, - workerUsage.elu.idle.minimum + workerUsage.elu.idle.minimum ?? Infinity ) workerUsage.elu.idle.maximum = Math.max( message.taskPerformance.elu.idle, - workerUsage.elu.idle.maximum + workerUsage.elu.idle.maximum ?? -Infinity ) workerUsage.elu.active.minimum = Math.min( message.taskPerformance.elu.active, - workerUsage.elu.active.minimum + workerUsage.elu.active.minimum ?? Infinity ) workerUsage.elu.active.maximum = Math.max( message.taskPerformance.elu.active, - workerUsage.elu.active.maximum + workerUsage.elu.active.maximum ?? -Infinity ) } if (