Clean only stale locks (safe operation).
(cache_dir: Path)
| 94 | |
| 95 | |
| 96 | def clean_stale(cache_dir: Path) -> int: |
| 97 | """Clean only stale locks (safe operation).""" |
| 98 | print(f"🧹 Cleaning stale locks...") |
| 99 | |
| 100 | # Clean from database |
| 101 | db = get_lock_database() |
| 102 | db_cleaned = db.cleanup_stale_locks() |
| 103 | |
| 104 | # Clean from cache_dir (legacy files) |
| 105 | cache_cleaned = cleanup_stale_locks(cache_dir) |
| 106 | |
| 107 | total = db_cleaned + cache_cleaned |
| 108 | if total > 0: |
| 109 | print(f"✅ Cleaned {total} stale lock(s)") |
| 110 | else: |
| 111 | print("✅ No stale locks found") |
| 112 | |
| 113 | return 0 |
| 114 | |
| 115 | |
| 116 | def force_unlock_all(cache_dir: Path) -> int: |
no test coverage detected