From 600c45246ba5c062b46159ad34649c46f694f087 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Fri, 3 Feb 2023 18:33:37 -0600 Subject: [PATCH] set the detection events on exit and return early from processing --- frigate/app.py | 5 +++++ frigate/video.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/frigate/app.py b/frigate/app.py index f23ff9c62..9ad5acda9 100644 --- a/frigate/app.py +++ b/frigate/app.py @@ -416,6 +416,11 @@ class FrigateApp: logger.info(f"Stopping...") self.stop_event.set() + # Set the events for the camera processor processes because + # they may be waiting on the event coming out of the detection process + for name in self.config.cameras.keys(): + self.detection_out_events[name].set() + self.dispatcher.stop() self.detected_frames_processor.join() self.event_processor.join() diff --git a/frigate/video.py b/frigate/video.py index 1c20c26d3..1b64b21a4 100755 --- a/frigate/video.py +++ b/frigate/video.py @@ -723,6 +723,9 @@ def process_frames( object_filters, ) ) + # if frigate is exiting + if stop_event.is_set(): + return ######### # merge objects, check for clipped objects and look again up to 4 times @@ -787,6 +790,9 @@ def process_frames( refining = True else: selected_objects.append(obj) + # if frigate is exiting + if stop_event.is_set(): + return # set the detections list to only include top, complete objects # and new detections detections = selected_objects