From 8fa8761a44550c4c380fe609d1f7df0026b1c2da Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Thu, 22 Oct 2026 15:15:43 -0500 Subject: [PATCH] keep recording cleanup running after a failed pass An exception anywhere in a cleanup pass, such as an OSError from a read-only or unmounted storage path, ended the recording cleanup thread with nothing logged. Retention stopped until restart, and recordings, previews and database rows kept growing. Each pass now logs the exception and the loop continues. --- frigate/record/cleanup.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/frigate/record/cleanup.py b/frigate/record/cleanup.py index 509c43ae14..429193f822 100644 --- a/frigate/record/cleanup.py +++ b/frigate/record/cleanup.py @@ -516,10 +516,13 @@ class RecordingCleanup(threading.Thread): logger.info("Exiting recording cleanup...") break - self.clean_tmp_previews() + try: + self.clean_tmp_previews() - if counter == 0: - self.clean_tmp_clips() - maybe_empty_dirs = self.expire_recordings() - remove_empty_directories(Path(RECORD_DIR), maybe_empty_dirs) - self.truncate_wal() + if counter == 0: + self.clean_tmp_clips() + maybe_empty_dirs = self.expire_recordings() + remove_empty_directories(Path(RECORD_DIR), maybe_empty_dirs) + self.truncate_wal() + except Exception: + logger.exception("Recording cleanup pass failed")