From 23e4439f22bcbb15e329ab24b6dfbfd7d415dba5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 4 Jul 2023 22:22:27 +0200 Subject: [PATCH] refactor: safer Math.{min,max} usage MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/pools/abstract-pool.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 ( -- 2.34.1