fix(net): resolve 1GB upload hang and macos build (Issue #1001 regression) (#1035)

This commit is contained in:
Jitter
2025-12-07 15:35:51 +05:30
committed by GitHub
parent 5f256249f4
commit cd6a26bc3a
4 changed files with 295 additions and 238 deletions
+10 -1
View File
@@ -32,7 +32,16 @@ use crate::{EtagResolvable, HashReaderDetector, HashReaderMut};
fn get_http_client() -> Client {
// Reuse the HTTP connection pool in the global `reqwest::Client` instance
// TODO: interact with load balancing?
static CLIENT: LazyLock<Client> = LazyLock::new(Client::new);
static CLIENT: LazyLock<Client> = LazyLock::new(|| {
Client::builder()
.connect_timeout(std::time::Duration::from_secs(5))
.tcp_keepalive(std::time::Duration::from_secs(10))
.http2_keep_alive_interval(std::time::Duration::from_secs(5))
.http2_keep_alive_timeout(std::time::Duration::from_secs(3))
.http2_keep_alive_while_idle(true)
.build()
.expect("Failed to create global HTTP client")
});
CLIENT.clone()
}