Fix for SBS-1 get_aircraft_id list cleanup.

This commit is contained in:
Nick Foster 2012-10-29 09:19:04 -07:00
parent 1adbf81950
commit 504f9265b2

View File

@ -52,11 +52,10 @@ class output_sbs1(air_modes.parse):
# Checking to see if we need to clean up in the event that the # Checking to see if we need to clean up in the event that the
# dictionary is getting too large. # dictionary is getting too large.
if len(self._aircraft_id_map) > 1e4: if len(self._aircraft_id_map) > 1e4:
minimum = ('', self._aircraft_id_count) earliest = len(self._aircraft_id_map) - 1e4
for pair in self._aircraft_id_map: for icao, _id in self._aircraft_id_map:
if pair[1] < minimum[1]: if _id < earliest:
minimum = pair del self._aircraft_id_map[icao]
self._aircraft_id_map.pop(minimum[0])
# Finally return the new pair # Finally return the new pair
return self._aircraft_id_count return self._aircraft_id_count