From 7090b808af6ab5248d4e4bd6941d4ddba63a1136 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Fri, 16 Feb 2024 11:49:22 -0700 Subject: [PATCH] Ensure that all processes are stopped --- frigate/app.py | 1 + frigate/events/audio.py | 1 + frigate/motion/__init__.py | 4 ++++ frigate/motion/improved_motion.py | 4 ++++ frigate/output/birdseye.py | 1 + frigate/record/maintainer.py | 1 + frigate/video.py | 2 ++ 7 files changed, 14 insertions(+) diff --git a/frigate/app.py b/frigate/app.py index d3861af2c..c78243a16 100644 --- a/frigate/app.py +++ b/frigate/app.py @@ -685,6 +685,7 @@ class FrigateApp: self.detection_queue.join_thread() self.dispatcher.stop() + self.inter_config_updater.stop() self.detected_frames_processor.join() self.ptz_autotracker_thread.join() self.event_processor.join() diff --git a/frigate/events/audio.py b/frigate/events/audio.py index c56bfa1a8..6a1a6269a 100644 --- a/frigate/events/audio.py +++ b/frigate/events/audio.py @@ -351,3 +351,4 @@ class AudioEventMaintainer(threading.Thread): stop_ffmpeg(self.audio_listener, self.logger) self.logpipe.close() self.requestor.stop() + self.config_subscriber.stop() diff --git a/frigate/motion/__init__.py b/frigate/motion/__init__.py index 248c37092..db5f25879 100644 --- a/frigate/motion/__init__.py +++ b/frigate/motion/__init__.py @@ -24,3 +24,7 @@ class MotionDetector(ABC): @abstractmethod def is_calibrating(self): pass + + @abstractmethod + def stop(self): + pass diff --git a/frigate/motion/improved_motion.py b/frigate/motion/improved_motion.py index a9677a468..e09c1547f 100644 --- a/frigate/motion/improved_motion.py +++ b/frigate/motion/improved_motion.py @@ -201,3 +201,7 @@ class ImprovedMotionDetector(MotionDetector): self.motion_frame_count = 0 return motion_boxes + + def stop(self) -> None: + """stop the motion detector.""" + self.config_subscriber.stop() diff --git a/frigate/output/birdseye.py b/frigate/output/birdseye.py index b4ac2198f..99ff3a6fa 100644 --- a/frigate/output/birdseye.py +++ b/frigate/output/birdseye.py @@ -785,5 +785,6 @@ class Birdseye: pass def stop(self) -> None: + self.config_subscriber.stop() self.converter.join() self.broadcaster.join() diff --git a/frigate/record/maintainer.py b/frigate/record/maintainer.py index 64c2143eb..70dee66ba 100644 --- a/frigate/record/maintainer.py +++ b/frigate/record/maintainer.py @@ -543,4 +543,5 @@ class RecordingMaintainer(threading.Thread): wait_time = max(0, 5 - duration) self.requestor.stop() + self.config_subscriber.stop() logger.info("Exiting recording maintenance...") diff --git a/frigate/video.py b/frigate/video.py index d954f78fc..6d6230de7 100755 --- a/frigate/video.py +++ b/frigate/video.py @@ -817,4 +817,6 @@ def process_frames( detection_fps.value = object_detector.fps.eps() frame_manager.close(f"{camera_name}{frame_time}") + motion_detector.stop() requestor.stop() + config_subscriber.stop()