cleanup_stale_locks

Function cleanup_stale_locks 

Source
pub async fn cleanup_stale_locks(
    cache_dir: &Path,
    ttl_seconds: u64,
) -> Result<usize>
Expand description

Cleans up stale lock files in the cache directory.

This function removes lock files that are older than the specified TTL. It’s useful for cleaning up after crashes or processes that didn’t properly release their locks.

§Parameters

  • cache_dir - The cache directory containing the .locks subdirectory
  • ttl_seconds - Time-to-live in seconds for lock files

§Returns

Returns the number of lock files that were removed.

§Errors

Returns an error if unable to read the locks directory or access lock file metadata