Skip to content

Commit

Permalink
Cleanup handling of first object message (#15480)
Browse files Browse the repository at this point in the history
  • Loading branch information
NickM-27 authored Dec 13, 2024
1 parent d302b6e commit f336a91
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions frigate/events/maintainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,23 @@ def run(self) -> None:
)

if source_type == EventTypeEnum.tracked_object:
id = event_data["id"]
self.timeline_queue.put(
(
camera,
source_type,
event_type,
self.events_in_process.get(event_data["id"]),
self.events_in_process.get(id),
event_data,
)
)

if event_type == EventStateEnum.start:
self.events_in_process[event_data["id"]] = event_data
# if this is the first message, just store it and continue, its not time to insert it in the db
if (
event_type == EventStateEnum.start
or id not in self.events_in_process
):
self.events_in_process[id] = event_data
continue

self.handle_object_detection(event_type, camera, event_data)
Expand Down Expand Up @@ -123,10 +128,6 @@ def handle_object_detection(
"""handle tracked object event updates."""
updated_db = False

# if this is the first message, just store it and continue, its not time to insert it in the db
if event_type == EventStateEnum.start:
self.events_in_process[event_data["id"]] = event_data

if should_update_db(self.events_in_process[event_data["id"]], event_data):
updated_db = True
camera_config = self.config.cameras[camera]
Expand Down

0 comments on commit f336a91

Please sign in to comment.