Cleanup for lock driven numbered directories.
(
root: Path, prefix: str, keep: int, consider_lock_dead_if_created_before: float
)
| 358 | |
| 359 | |
| 360 | def cleanup_numbered_dir( |
| 361 | root: Path, prefix: str, keep: int, consider_lock_dead_if_created_before: float |
| 362 | ) -> None: |
| 363 | """Cleanup for lock driven numbered directories.""" |
| 364 | if not root.exists(): |
| 365 | return |
| 366 | for path in cleanup_candidates(root, prefix, keep): |
| 367 | try_cleanup(path, consider_lock_dead_if_created_before) |
| 368 | for path in root.glob("garbage-*"): |
| 369 | try_cleanup(path, consider_lock_dead_if_created_before) |
| 370 | |
| 371 | cleanup_dead_symlinks(root) |
| 372 | |
| 373 | |
| 374 | def make_numbered_dir_with_cleanup( |