Skip to content

Commit

Permalink
fixed runtime error when iterating over cache and deleting elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Henjuro committed Nov 24, 2020
1 parent b76d899 commit 44a1449
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions waitlist/utility/timetracking/timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def check_fleets(self):
self.register_fleet_time(fleet_id, self.cache[fleet_id])
del self.cache[fleet_id]

for fleet_id in self.cache.keys():
for fleet_id in list(self.cache.keys()):
logger.debug('Checking members in fleet with id=%s', fleet_id)
if fleet_id in fleet_ids:
# these ones we need to check for missing members, because they left the fleet
Expand All @@ -96,7 +96,7 @@ def check_fleets(self):
# if we get stale data, because e.g. we have no valid api key
# just skip this fleet
if fleet_new_data is None:
logger.info('Fleet with id=%s is not in cache anymore also its key still exists in database, removing', fleet_id)
logger.info('Fleet with id=%s is not in global fleet cache anymore although its key still exists in our cache, removing', fleet_id)
# the fleet disappeared register remaining mebers time
self.register_fleet_time(fleet_id, self.cache[fleet_id])
del self.cache[fleet_id]
Expand Down

0 comments on commit 44a1449

Please sign in to comment.