Fix recording segment management (#8220)

* Fix timing error

* Downgrade logs
This commit is contained in:
Nicolas Mowen 2023-10-18 17:18:22 -06:00 committed by GitHub
parent 282cbf8f40
commit 98200b7dda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -406,6 +406,7 @@ class RecordingMaintainer(threading.Thread):
return None
def run(self) -> None:
camera_count = len(self.config.cameras.keys())
# Check for new files every 5 seconds
wait_time = 0.0
while not self.stop_event.wait(wait_time):
@ -421,7 +422,7 @@ class RecordingMaintainer(threading.Thread):
current_tracked_objects,
motion_boxes,
regions,
) = self.object_recordings_info_queue.get(True, timeout=0.1)
) = self.object_recordings_info_queue.get(True, timeout=0.01)
if frame_time < run_start - stale_frame_count_threshold:
stale_frame_count += 1
@ -437,15 +438,15 @@ class RecordingMaintainer(threading.Thread):
)
except queue.Empty:
q_size = self.object_recordings_info_queue.qsize()
if q_size > 5:
logger.warning(
f"object_recordings_info loop queue not empty ({q_size}) - recording segments may be missing"
if q_size > camera_count:
logger.debug(
f"object_recordings_info loop queue not empty ({q_size})."
)
break
if stale_frame_count > 0:
logger.error(
f"Found {stale_frame_count} old frames, segments from recordings may be missing"
logger.warning(
f"Found {stale_frame_count} old frames, segments from recordings may be missing."
)
# empty the audio recordings info queue if audio is enabled
@ -458,7 +459,7 @@ class RecordingMaintainer(threading.Thread):
camera,
frame_time,
dBFS,
) = self.audio_recordings_info_queue.get(True, timeout=0.1)
) = self.audio_recordings_info_queue.get(True, timeout=0.01)
if frame_time < run_start - stale_frame_count_threshold:
stale_frame_count += 1
@ -472,9 +473,9 @@ class RecordingMaintainer(threading.Thread):
)
except queue.Empty:
q_size = self.audio_recordings_info_queue.qsize()
if q_size > 5:
logger.warning(
f"object_recordings_info loop audio queue not empty ({q_size}) - recording segments may be missing"
if q_size > camera_count:
logger.debug(
f"object_recordings_info loop audio queue not empty ({q_size})."
)
break