Clear file before unlinking (#5259)

This commit is contained in:
Nicolas Mowen 2023-01-27 05:16:40 -07:00 committed by GitHub
parent 93f2316711
commit 7926ddd008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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):