Explorar el Código

handle missing file edge case

Blake Blackshear hace 3 años
padre
commit
07ad2d97b1
Se han modificado 1 ficheros con 5 adiciones y 2 borrados
  1. 5 2
      frigate/record.py

+ 5 - 2
frigate/record.py

@@ -405,8 +405,11 @@ class RecordingCleanup(threading.Thread):
 
         for f in files_to_check:
             p = Path(f)
-            if p.stat().st_mtime < delete_before.get(p.parent.name, default_expire):
-                p.unlink(missing_ok=True)
+            try:
+                if p.stat().st_mtime < delete_before.get(p.parent.name, default_expire):
+                    p.unlink(missing_ok=True)
+            except FileNotFoundError:
+                logger.warning(f"Attempted to expire missing file: {f}")
 
         logger.debug("End expire files (legacy).")