Clear file before unlinking

This commit is contained in:
Nicolas Mowen 2023-01-26 13:52:10 -07:00 committed by Nick Mowen
parent fd3688a9c7
commit c7bac2cad4

View File

@ -411,6 +411,10 @@ class RecordingCleanup(threading.Thread):
logger.debug(f"Checking tmp clip {p}.") logger.debug(f"Checking tmp clip {p}.")
if p.stat().st_mtime < (datetime.datetime.now().timestamp() - 60 * 1): if p.stat().st_mtime < (datetime.datetime.now().timestamp() - 60 * 1):
logger.debug("Deleting tmp clip.") 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) p.unlink(missing_ok=True)
def expire_recordings(self): def expire_recordings(self):