From f7ac6875c3436c6ccaffe210b52fc7d68119e303 Mon Sep 17 00:00:00 2001 From: konsti Date: Wed, 23 Jul 2025 18:52:39 +0200 Subject: [PATCH] Improve concurrency safety of Python downloads into cache (#14846) --- crates/uv-python/src/downloads.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/uv-python/src/downloads.rs b/crates/uv-python/src/downloads.rs index ad516d096..05bf17cd1 100644 --- a/crates/uv-python/src/downloads.rs +++ b/crates/uv-python/src/downloads.rs @@ -988,7 +988,11 @@ impl ManagedPythonDownload { archive_writer.flush().await?; } // Move the completed file into place, invalidating the `File` instance. - fs_err::rename(&temp_file, target_cache_file)?; + match rename_with_retry(&temp_file, target_cache_file).await { + Ok(()) => {} + Err(_) if target_cache_file.is_file() => {} + Err(err) => return Err(err.into()), + } Ok(()) }