Fix ids_needed being modified while iterating.

This commit is contained in:
voussoir 2018-04-15 02:35:46 -07:00
parent 518a45ccd8
commit 0ee07023a1

View file

@ -1469,16 +1469,15 @@ class PhotoDB(
thing_class = thing_map['class'] thing_class = thing_map['class']
thing_cache = self.caches[thing_type] thing_cache = self.caches[thing_type]
ids_needed = set(thing_ids) ids_needed = set()
things = set() things = set()
for thing_id in ids_needed: for thing_id in thing_ids:
try: try:
thing = thing_cache[thing_id] thing = thing_cache[thing_id]
except KeyError: except KeyError:
pass ids_needed.add(thing_id)
else: else:
things.add(thing) things.add(thing)
ids_needed.remove(thing.id)
yield from things yield from things