From c7bac2cad4f43dddc05708ba16ad21332e1c100d Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 26 Jan 2023 13:52:10 -0700 Subject: [PATCH] Clear file before unlinking --- frigate/record.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frigate/record.py b/frigate/record.py index 7b112f7f4..f83f6cd03 100644 --- a/frigate/record.py +++ b/frigate/record.py @@ -411,6 +411,10 @@ class RecordingCleanup(threading.Thread): logger.debug(f"Checking tmp clip {p}.") if p.stat().st_mtime < (datetime.datetime.now().timestamp() - 60 * 1): logger.debug("Deleting tmp clip.") + + # empty contents of file before unlinking https://github.com/blakeblackshear/frigate/issues/4769 + with open(p, "w"): + pass p.unlink(missing_ok=True) def expire_recordings(self):