Remove uneeded intermediate variable in fair share tasks scheduler
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 15 Oct 2022 17:47:16 +0000 (19:47 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 15 Oct 2022 17:47:16 +0000 (19:47 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/pools/selection-strategies/fair-share-worker-choice-strategy.ts

index 48f213ffebb1a4577debff4e701ef45f53e2ebed..59dcc3d65ce28cb248beba3b6c57143e7556ec09 100644 (file)
@@ -70,12 +70,11 @@ export class FairShareWorkerChoiceStrategy<
       Date.now(),
       this.workerLastVirtualTaskTimestamp.get(worker)?.end ?? -Infinity
     )
-    const workerVirtualTaskEndTimestamp =
-      workerVirtualTaskStartTimestamp +
-      (this.pool.getWorkerAverageTasksRunTime(worker) ?? 0)
     this.workerLastVirtualTaskTimestamp.set(worker, {
       start: workerVirtualTaskStartTimestamp,
-      end: workerVirtualTaskEndTimestamp
+      end:
+        workerVirtualTaskStartTimestamp +
+        (this.pool.getWorkerAverageTasksRunTime(worker) ?? 0)
     })
   }
 }