mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-20 11:56:03 +00:00
Skip existing, second iteration: Check the index before uploading (#8531)
Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
parent
b52f229862
commit
082259493e
14 changed files with 487 additions and 223 deletions
|
|
@ -31,7 +31,7 @@ use crate::cached_client::CacheControl;
|
|||
use crate::html::SimpleHtml;
|
||||
use crate::remote_metadata::wheel_metadata_from_remote_zip;
|
||||
use crate::rkyvutil::OwnedArchive;
|
||||
use crate::{CachedClient, CachedClientError, Error, ErrorKind};
|
||||
use crate::{BaseClient, CachedClient, CachedClientError, Error, ErrorKind};
|
||||
|
||||
/// A builder for an [`RegistryClient`].
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
@ -143,6 +143,27 @@ impl<'a> RegistryClientBuilder<'a> {
|
|||
timeout,
|
||||
}
|
||||
}
|
||||
|
||||
/// Share the underlying client between two different middleware configurations.
|
||||
pub fn wrap_existing(self, existing: &BaseClient) -> RegistryClient {
|
||||
// Wrap in any relevant middleware and handle connectivity.
|
||||
let client = self.base_client_builder.wrap_existing(existing);
|
||||
|
||||
let timeout = client.timeout();
|
||||
let connectivity = client.connectivity();
|
||||
|
||||
// Wrap in the cache middleware.
|
||||
let client = CachedClient::new(client);
|
||||
|
||||
RegistryClient {
|
||||
index_urls: self.index_urls,
|
||||
index_strategy: self.index_strategy,
|
||||
cache: self.cache,
|
||||
connectivity,
|
||||
client,
|
||||
timeout,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TryFrom<BaseClientBuilder<'a>> for RegistryClientBuilder<'a> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue