fix sporadic system crashes

This commit is contained in:
Sven Czarnian
2021-12-25 22:37:20 +01:00
parent 357f6e7b11
commit c9937d39c2

View File

@@ -175,11 +175,18 @@ class RecedingHorizonControl:
return runwayInbounds, iafInbounds return runwayInbounds, iafInbounds
def optimizationRelevantInbounds(self): def optimizationRelevantInbounds(self):
if 0 == len(self.Windows):
return None, None
inbounds = [] inbounds = []
if self.FreezedIndex + 1 >= len(self.Windows):
earliestArrivalTime = dt.utcfromtimestamp(int(time.time())).replace(tzinfo = pytz.UTC)
earliestArrivalTime += self.Configuration.FixedBeforeArrival
else:
earliestArrivalTime = self.Windows[self.FreezedIndex + 1].StartTime earliestArrivalTime = self.Windows[self.FreezedIndex + 1].StartTime
# check if we have a reconnect in the freezed blocks (VATSIM specific behavior) # check if we have a reconnect in the freezed blocks (VATSIM specific behavior)
for i in range(0, self.FreezedIndex + 1): for i in range(0, min(len(self.Windows), self.FreezedIndex + 1)):
for inbound in self.Windows[i].Inbounds: for inbound in self.Windows[i].Inbounds:
if False == inbound.HasValidSequence: if False == inbound.HasValidSequence:
inbounds.sort(key = lambda x: x.PlannedArrivalTime if None != x.PlannedArrivalTime else x.EnrouteArrivalTime) inbounds.sort(key = lambda x: x.PlannedArrivalTime if None != x.PlannedArrivalTime else x.EnrouteArrivalTime)