patches/neon-proxy-control-plane-timeout.patch
Rama main · réplica de lectura del repositorio original.
diff --git a/proxy/src/binary/proxy.rs b/proxy/src/binary/proxy.rs
index 583cdc9..86c84ed 100644
--- a/proxy/src/binary/proxy.rs
+++ b/proxy/src/binary/proxy.rs
@@ -814,7 +814,10 @@ fn build_auth_backend(
let url: crate::url::ApiUrl = args.auth_endpoint.parse()?;
- let endpoint = http::Endpoint::new(url, http::new_client());
+ let endpoint = http::Endpoint::new(
+ url,
+ http::new_control_plane_client(Duration::from_secs(2)),
+ );
let mut wake_compute_rps_limit = args.wake_compute_limit.clone();
RateBucketInfo::validate(&mut wake_compute_rps_limit)?;
@@ -891,7 +894,10 @@ fn build_auth_backend(
let url = args.uri.clone().parse()?;
let ep_url: crate::url::ApiUrl = args.auth_endpoint.parse()?;
- let endpoint = http::Endpoint::new(ep_url, http::new_client());
+ let endpoint = http::Endpoint::new(
+ ep_url,
+ http::new_control_plane_client(Duration::from_secs(2)),
+ );
let mut wake_compute_rps_limit = args.wake_compute_limit.clone();
RateBucketInfo::validate(&mut wake_compute_rps_limit)?;
let wake_compute_endpoint_rate_limiter =
diff --git a/proxy/src/http/mod.rs b/proxy/src/http/mod.rs
index 36607e7..b29aab8 100644
--- a/proxy/src/http/mod.rs
+++ b/proxy/src/http/mod.rs
@@ -34,6 +34,20 @@ pub fn new_client() -> ClientWithMiddleware {
.build()
}
+/// HTTP client for security-sensitive control-plane lookups. Unlike the
+/// general client, every request has a fixed upper bound and is not retried by
+/// middleware; callers own any retry policy at the operation boundary.
+pub fn new_control_plane_client(request_timeout: Duration) -> ClientWithMiddleware {
+ let client = reqwest::ClientBuilder::new()
+ .timeout(request_timeout)
+ .build()
+ .expect("Failed to create control plane http client with timeout");
+
+ reqwest_middleware::ClientBuilder::new(client)
+ .with(reqwest_tracing::TracingMiddleware::default())
+ .build()
+}
+
pub(crate) fn new_client_with_timeout(
request_timeout: Duration,
total_retry_duration: Duration,