Improve concurrency safety of Python downloads into cache (#14846)

This commit is contained in:
konsti 2025-07-23 18:52:39 +02:00 committed by GitHub
parent 310a9d3426
commit f7ac6875c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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(())
}