mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-27 20:49:13 +00:00
Avoid race when unpacking wheels (#593)
## Summary If someone else beats us to the unzip, we should let them win. We already have a check for this at the top of the unzip method, but it's also possible that two source distributions get built in parallel that both try to unpack the same build dependency.
This commit is contained in:
parent
5ae3a8b1cb
commit
cbe1cb4229
1 changed files with 9 additions and 1 deletions
|
@ -59,7 +59,15 @@ impl Unzipper {
|
|||
download.unzip(staging.path())?;
|
||||
|
||||
// Move the unzipped wheel into the cache,.
|
||||
fs_err::rename(staging.into_path(), download.target())?;
|
||||
if let Err(err) = fs_err::rename(staging.into_path(), download.target()) {
|
||||
// If another thread already unpacked the wheel, we can ignore the error.
|
||||
return if download.target().is_dir() {
|
||||
warn!("Wheel is already unpacked: {}", download.remote());
|
||||
Ok(download.target().to_path_buf())
|
||||
} else {
|
||||
Err(err.into())
|
||||
};
|
||||
}
|
||||
|
||||
Ok(download.target().to_path_buf())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue