From ad27b3c7bed89345cda4274774d427b2bab78d92 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Sun, 11 Jun 2023 21:08:42 -0600 Subject: [PATCH] Fix division by zero --- frigate/record/cleanup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frigate/record/cleanup.py b/frigate/record/cleanup.py index 75a1f9508..bb5022c93 100644 --- a/frigate/record/cleanup.py +++ b/frigate/record/cleanup.py @@ -241,7 +241,7 @@ class RecordingCleanup(threading.Thread): {"id": recording_id} for recording_id in recordings_to_delete ] - if len(recordings_to_delete) / recordings.count() > 0.5: + if len(recordings_to_delete) / max(1, recordings.count()) > 0.5: logger.debug( f"Deleting {(len(recordings_to_delete) / recordings.count()):2f}% of recordings could be due to configuration error. Aborting..." )