Skip to content

Commit

Permalink
Enforce HTTP timeouts on a per-read (rather than per-request) basis (#…
Browse files Browse the repository at this point in the history
…3144)

## Summary

This leverages the new `read_timeout` property, which ensures that (like
pip) our timeout is not applied to the _entire_ request, but rather, to
each individual read operation.

Closes: #1921.

See: #1912.
  • Loading branch information
charliermarsh authored Apr 19, 2024
1 parent 31765c0 commit 9f2bc19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/uv-client/src/base_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl<'a> BaseClientBuilder<'a> {
})
})
.unwrap_or(default_timeout);
debug!("Using registry request timeout of {}s", timeout);
debug!("Using registry request timeout of {timeout}s");

// Initialize the base client.
let client = self.client.clone().unwrap_or_else(|| {
Expand All @@ -145,7 +145,7 @@ impl<'a> BaseClientBuilder<'a> {
let client_core = ClientBuilder::new()
.user_agent(user_agent_string)
.pool_max_idle_per_host(20)
.timeout(std::time::Duration::from_secs(timeout))
.read_timeout(std::time::Duration::from_secs(timeout))
.tls_built_in_root_certs(false);

// Configure TLS.
Expand Down

0 comments on commit 9f2bc19

Please sign in to comment.