From 7926ddd008f23c4d8a584d30c3c4dafe73ff6e4b Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Fri, 27 Jan 2023 05:16:40 -0700 Subject: [PATCH] Clear file before unlinking (#5259) --- 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):