Don't run for a camera with no recording segments

This commit is contained in:
Nick Mowen 2022-09-26 14:21:14 -06:00
parent ac03e842bc
commit 132274579c

View File

@ -84,7 +84,6 @@ class StorageMaintainer(threading.Thread):
) -> set[str]: ) -> set[str]:
"""Delete Recording Segments""" """Delete Recording Segments"""
# loop over recordings and see if they overlap with any retained events # loop over recordings and see if they overlap with any retained events
# TODO: expire segments based on segment stats according to config
event_start = 0 event_start = 0
deleted_recordings = set() deleted_recordings = set()
for recording in recordings.objects().iterator(): for recording in recordings.objects().iterator():
@ -140,6 +139,9 @@ class StorageMaintainer(threading.Thread):
.limit(segment_count * 12) .limit(segment_count * 12)
) )
if len(recordings) == 0:
continue
# cameras that are only recording part time # cameras that are only recording part time
# should not be forced to have 2 hours of # should not be forced to have 2 hours of
# recordings disabled # recordings disabled