From bc350644bd8d68e47ff4df920892301d644b5fcc Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Fri, 17 Sep 2021 17:12:03 -0500 Subject: [PATCH] make expiration of deleted camera footage faster --- frigate/record.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frigate/record.py b/frigate/record.py index c2c97f18b..a3274473f 100644 --- a/frigate/record.py +++ b/frigate/record.py @@ -166,9 +166,13 @@ class RecordingCleanup(threading.Thread): Recordings.end_time < expire_before, ) + deleted_recordings = set() for recording in no_camera_recordings: Path(recording.path).unlink(missing_ok=True) - Recordings.delete_by_id(recording.id) + deleted_recordings.add(recording.id) + + logger.debug(f"Expiring {len(deleted_recordings)} recordings") + Recordings.delete().where(Recordings.id << deleted_recordings).execute() logger.debug("End deleted cameras.") logger.debug("Start all cameras.")