Restrict snapshot-scan pruning to hour/minute leaf directories #122
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/122/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
prune_empty_dirs(cam.root)in_scan_snapshots_for_cameracould delete theYYYY-MM-DD/date directory when all snapshots for a date were processed. For cameras with frequent snapshot schedules (e.g. 1/minute), the camera would immediately recreate the directory under the same parent name. The kernel dcache returned stale emptyiterdir()results for the recreated directory, causing all subsequent scans to find 0 snapshots — permanently.Fix
Replace the blanket
prune_empty_dirs(cam.root)with targeted pruning of only the hour and minute leaf directories that the scan actually emptied. Date and channel directories are never deleted by the scan, eliminating the same-name-recreation race.Empty date/channel directories are harmless (minimal inode cost) and are cleaned up by the periodic retention cleanup job.
Closes #121