From f3c7de3c7de7d4029cd935eba1ea9f89b196e419 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Fri, 28 Jun 2024 10:23:09 -0400 Subject: [PATCH] Retry on spurious failures when caching built wheels (#4605) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/astral-sh/uv/pull/2419 appears to have only applied this retry to wheels that were already downloaded (though I would have to look more carefully to be certain). In https://github.com/astral-sh/uv/issues/1491, we've gotten continued reports of spurious failures on Windows and tracing reveals that we are not applying our retry logic during the rename. I believe we're in this code path — switching to our backoff retry should resolve the failures. --- crates/uv-build/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/uv-build/src/lib.rs b/crates/uv-build/src/lib.rs index c42c571a9bd3..76ccbb95142f 100644 --- a/crates/uv-build/src/lib.rs +++ b/crates/uv-build/src/lib.rs @@ -30,7 +30,7 @@ use pep440_rs::Version; use pep508_rs::PackageName; use pypi_types::{Requirement, VerbatimParsedUrl}; use uv_configuration::{BuildKind, ConfigSettings, SetupPyStrategy}; -use uv_fs::{PythonExt, Simplified}; +use uv_fs::{rename_with_retry, PythonExt, Simplified}; use uv_toolchain::{Interpreter, PythonEnvironment}; use uv_types::{BuildContext, BuildIsolation, SourceBuildTrait}; @@ -757,7 +757,7 @@ impl SourceBuild { let from = tmp_dir.path().join(&filename); let to = wheel_dir.join(&filename); - fs_err::rename(from, to)?; + rename_with_retry(from, to).await?; Ok(filename) } else { if self.build_kind != BuildKind::Wheel {