Clean up enabled config updates (#17547)

* Immediately end review item for disabled cameras

* Clean up checks

* Remove duplicate enabled checkers

* Cleanup
This commit is contained in:
Nicolas Mowen
2025-04-05 08:47:58 -05:00
committed by GitHub
parent e60df795ad
commit 7bfcf2040d
3 changed files with 28 additions and 37 deletions
+10 -4
View File
@@ -482,6 +482,10 @@ class ReviewSegmentMaintainer(threading.Thread):
camera_name = updated_record_topic.rpartition("/")[-1]
self.config.cameras[camera_name].record = updated_record_config
# immediately end segment
if not updated_record_config.enabled:
self.end_segment(camera_name)
if updated_review_topic:
camera_name = updated_review_topic.rpartition("/")[-1]
self.config.cameras[camera_name].review = updated_review_config
@@ -492,6 +496,10 @@ class ReviewSegmentMaintainer(threading.Thread):
camera_name
].enabled = updated_enabled_config.enabled
# immediately end segment as we may not get another update
if not updated_enabled_config.enabled:
self.end_segment(camera_name)
(topic, data) = self.detection_subscriber.check_for_update(timeout=1)
if not topic:
@@ -523,16 +531,14 @@ class ReviewSegmentMaintainer(threading.Thread):
if camera not in self.indefinite_events:
self.indefinite_events[camera] = {}
current_segment = self.active_review_segments.get(camera)
if (
not self.config.cameras[camera].enabled
or not self.config.cameras[camera].record.enabled
):
if current_segment:
self.end_segment(camera)
continue
current_segment = self.active_review_segments.get(camera)
# Check if the current segment should be processed based on enabled settings
if current_segment:
if (