perf: remove unneeded nullish checks in hot code paths
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 6 Apr 2023 06:53:39 +0000 (08:53 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 6 Apr 2023 06:53:39 +0000 (08:53 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/pools/selection-strategies/less-used-worker-choice-strategy.ts

index 01332caf7f41cf086596c325173ac639f7b7cb39..dffed99e8f6ece8658fd6b22688598e1374ece6b 100644 (file)
@@ -31,7 +31,7 @@ export class LessUsedWorkerChoiceStrategy<
     let lessUsedWorkerKey!: number
     for (const [index, workerItem] of this.pool.workers.entries()) {
       const tasksUsage = workerItem.tasksUsage
-      const workerTasks = tasksUsage?.run + tasksUsage?.running
+      const workerTasks = tasksUsage.run + tasksUsage.running
       if (workerTasks === 0) {
         return index
       } else if (workerTasks < minNumberOfTasks) {