+ private fairShareNextWorkerNodeKey (): number | undefined {
+ return this.pool.workerNodes.reduce(
+ (minWorkerNodeKey, workerNode, workerNodeKey, workerNodes) => {
+ if (workerNode.strategyData?.virtualTaskEndTimestamp == null) {
+ workerNode.strategyData = {
+ virtualTaskEndTimestamp:
+ this.computeWorkerNodeVirtualTaskEndTimestamp(workerNodeKey)
+ }
+ }
+ return this.isWorkerNodeReady(workerNodeKey) &&
+ (workerNode.strategyData.virtualTaskEndTimestamp as number) <
+ ((workerNodes[minWorkerNodeKey].strategyData as StrategyData)
+ .virtualTaskEndTimestamp as number)
+ ? workerNodeKey
+ : minWorkerNodeKey
+ },
+ 0
+ )
+ }
+