Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions crates/pm/src/util/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ pub fn build_dns_cached_client() -> reqwest::Client {
client_builder()
.connect_timeout(std::time::Duration::from_secs(5)) // TLS + TCP handshake
.read_timeout(std::time::Duration::from_secs(30)) // Timeout for individual read operations
// Tarballs are already gzip; don't invite a second Content-Encoding
// layer that would just burn CPU on decode.
.no_gzip()
// HTTP/1.1 so each in-flight tarball gets its own TCP connection.
// With ALPN h2 the registry CDN multiplexes every stream over one
// connection (single congestion window + flow-control cap, loss on
// one stream stalls siblings) — same rationale as the manifest
// client in ruborist/src/service/http.rs. Same-runner A/B measured
// h2 at +9.8% on p3 cold install against npmjs and +35% against
// npmmirror.
.http1_only()
// No total timeout - large files (e.g. node binary ~100MB) need longer download time
// No pool_max_idle_per_host - let reqwest manage connections freely
// Concurrency is bounded by the resolver's in-flight fetch cap
Expand Down
10 changes: 8 additions & 2 deletions crates/ruborist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ workspace = true
tokio = { workspace = true, features = ["macros", "rt"] }

# Native (non-macOS) targets: reqwest's default rustls + ring.
# `gzip` lets the manifest client send Accept-Encoding and transparently
# decompress packuments (~2.5x smaller on registry.npmjs.org); brotli is
# only ~1% smaller than gzip there but decodes slower, so it stays off.
[target.'cfg(not(any(target_arch = "wasm32", target_os = "macos")))'.dependencies]
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls-native-roots"] }
reqwest = { version = "0.12", default-features = false, features = ["gzip", "rustls-tls-native-roots"] }

# Native-only dependencies (not compiled for WASM)
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
Expand All @@ -73,7 +76,10 @@ js-sys = "0.3"
# resolves on M-series ARM. CI bench-phases regresses on Linux/x86_64
# with this provider, so it's gated to macOS only. See service/http.rs.
[target.'cfg(target_os = "macos")'.dependencies]
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls-native-roots-no-provider"] }
reqwest = { version = "0.12", default-features = false, features = [
"gzip",
"rustls-tls-native-roots-no-provider"
] }
rustls = { version = "0.23", default-features = false, features = ["aws-lc-rs", "logging", "std", "tls12"] }
rustls-native-certs = "0.8"

Expand Down
Loading