Fix fair share strategy unix timestamp comparison
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 10 Oct 2022 08:54:32 +0000 (10:54 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 10 Oct 2022 08:54:32 +0000 (10:54 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/pools/selection-strategies/fair-share-worker-choice-strategy.ts

index f8f1821269144ed59f7b33b4cb21ab27e2ea7eeb..0d4773ff82f7ee91ce77114da582c59d15f7a201 100644 (file)
@@ -61,7 +61,7 @@ export class FairShareWorkerChoiceStrategy<
     for (const worker of this.pool.workers) {
       const workerVirtualTaskStartTimestamp = Math.max(
         Date.now(),
-        this.workerLastVirtualTaskTimestamp.get(worker)?.end ?? 0
+        this.workerLastVirtualTaskTimestamp.get(worker)?.end ?? -Infinity
       )
       const workerVirtualTaskEndTimestamp =
         workerVirtualTaskStartTimestamp +