From: Jérôme Benoit Date: Mon, 8 May 2023 22:47:21 +0000 (+0200) Subject: fix: do not add undefined task runtime to the history X-Git-Tag: v2.4.14~8 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;ds=sidebyside;h=3fa4cdd2951436bbb60a46b9d0ac151a4aa45ce1;hp=c6f42dd6037d12056294ff89be8ebb2fb66b1c8e;p=poolifier.git fix: do not add undefined task runtime to the history Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index eab110d8..b9a7cd39 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -440,8 +440,11 @@ export abstract class AbstractPool< workerTasksUsage.avgRunTime = workerTasksUsage.runTime / workerTasksUsage.run } - if (this.workerChoiceStrategyContext.getRequiredStatistics().medRunTime) { - workerTasksUsage.runTimeHistory.push(message.runTime ?? 0) + if ( + this.workerChoiceStrategyContext.getRequiredStatistics().medRunTime && + message.runTime != null + ) { + workerTasksUsage.runTimeHistory.push(message.runTime) workerTasksUsage.medRunTime = median(workerTasksUsage.runTimeHistory) } }