Remove parents in remove_empty_directories (#21726)

The original implementation did a full directory tree walk to find and remove
empty directories, so this implementation should remove the parents as well,
like the original did.
This commit is contained in:
John Shaw
2026-02-26 21:27:56 -07:00
committed by Nicolas Mowen
parent 9b7cee18db
commit af2339b35c
2 changed files with 26 additions and 12 deletions
+2 -2
View File
@@ -11,7 +11,7 @@ from pathlib import Path
from playhouse.sqlite_ext import SqliteExtDatabase
from frigate.config import CameraConfig, FrigateConfig, RetainModeEnum
from frigate.const import CACHE_DIR, CLIPS_DIR, MAX_WAL_SIZE
from frigate.const import CACHE_DIR, CLIPS_DIR, MAX_WAL_SIZE, RECORD_DIR
from frigate.models import Previews, Recordings, ReviewSegment, UserReviewStatus
from frigate.util.builtin import clear_and_unlink
from frigate.util.media import remove_empty_directories
@@ -379,5 +379,5 @@ class RecordingCleanup(threading.Thread):
if counter == 0:
self.clean_tmp_clips()
maybe_empty_dirs = self.expire_recordings()
remove_empty_directories(maybe_empty_dirs)
remove_empty_directories(Path(RECORD_DIR), maybe_empty_dirs)
self.truncate_wal()