From dfabff3846a25d36eebf7b105666703413bbe244 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Sun, 23 Feb 2020 11:18:00 -0600 Subject: [PATCH] dont change dictionary while iterating --- frigate/objects.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frigate/objects.py b/frigate/objects.py index 49cf5377f..411835d2b 100644 --- a/frigate/objects.py +++ b/frigate/objects.py @@ -63,12 +63,12 @@ class ObjectTracker(): # update any tracked objects with labels that are not # seen in the current objects and deregister if needed - for id, obj in self.tracked_objects.items(): + for obj in list(self.tracked_objects.values()): if not obj['label'] in new_object_groups: - if self.disappeared[id] >= self.max_disappeared: - self.deregister(id) + if self.disappeared[obj['id']] >= self.max_disappeared: + self.deregister(obj['id']) else: - self.disappeared[id] += 1 + self.disappeared[obj['id']] += 1 if len(new_objects) == 0: return