mirror of https://github.com/astral-sh/uv
Emit a message on `cache clean` and `prune` when lock is held (#16138)
Closes https://github.com/astral-sh/uv/issues/16112 ``` ❯ cargo run -q cache clean Cache is currently in-use, waiting for other uv processes to finish (use `--force` to override) ``` Otherwise, `-v` is required to see we're waiting on a lock. I'd rather do this than elevate the exclusive lock log message to something more verbose because this allows us to use a more specific message as appropriate for the situation. We also previously reduced the verbosity of arbitrary locks, e.g., see https://github.com/astral-sh/uv/issues/7489
This commit is contained in:
parent
7e4edf0fb4
commit
6f7d0dc7b4
|
|
@ -28,17 +28,19 @@ pub(crate) fn cache_clean(
|
||||||
return Ok(ExitStatus::Success);
|
return Ok(ExitStatus::Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
let cache = if force {
|
let cache = match cache.with_exclusive_lock_no_wait() {
|
||||||
// If `--force` is used, attempt to acquire the exclusive lock but do not block.
|
Ok(cache) => cache,
|
||||||
match cache.with_exclusive_lock_no_wait() {
|
Err(cache) if force => {
|
||||||
Ok(cache) => cache,
|
debug!("Cache is currently in use, proceeding due to `--force`");
|
||||||
Err(cache) => {
|
cache
|
||||||
debug!("Cache is currently in use, proceeding due to `--force`");
|
}
|
||||||
cache
|
Err(cache) => {
|
||||||
}
|
writeln!(
|
||||||
|
printer.stderr(),
|
||||||
|
"Cache is currently in-use, waiting for other uv processes to finish (use `--force` to override)"
|
||||||
|
)?;
|
||||||
|
cache.with_exclusive_lock()?
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
cache.with_exclusive_lock()?
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let summary = if packages.is_empty() {
|
let summary = if packages.is_empty() {
|
||||||
|
|
|
||||||
|
|
@ -26,17 +26,19 @@ pub(crate) fn cache_prune(
|
||||||
return Ok(ExitStatus::Success);
|
return Ok(ExitStatus::Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
let cache = if force {
|
let cache = match cache.with_exclusive_lock_no_wait() {
|
||||||
// If `--force` is used, attempt to acquire the exclusive lock but do not block.
|
Ok(cache) => cache,
|
||||||
match cache.with_exclusive_lock_no_wait() {
|
Err(cache) if force => {
|
||||||
Ok(cache) => cache,
|
debug!("Cache is currently in use, proceeding due to `--force`");
|
||||||
Err(cache) => {
|
cache
|
||||||
debug!("Cache is currently in use, proceeding due to `--force`");
|
}
|
||||||
cache
|
Err(cache) => {
|
||||||
}
|
writeln!(
|
||||||
|
printer.stderr(),
|
||||||
|
"Cache is currently in-use, waiting for other uv processes to finish (use `--force` to override)"
|
||||||
|
)?;
|
||||||
|
cache.with_exclusive_lock()?
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
cache.with_exclusive_lock()?
|
|
||||||
};
|
};
|
||||||
|
|
||||||
writeln!(
|
writeln!(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue