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
4 changes: 2 additions & 2 deletions model_gateway/src/routers/http/pd_router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@ impl PDRouter {
client
.post(endpoint_url)
.header(CONTENT_TYPE, HeaderValue::from_static("application/json")),
bytes::Bytes::from(body),
body,
);
if connection_close {
request = request.header("Connection", "close");
Expand Down Expand Up @@ -1910,7 +1910,7 @@ mod tests {
assert!(result.is_err());
// No workers at all is the pre-existing unavailable string, not a shed:
// an empty pool has nothing to be overloaded.
match result.unwrap_err() {
match *result.unwrap_err() {
PdSelectionFailure::Unavailable(error) => {
assert!(error.contains("No prefill workers available"));
}
Expand Down
2 changes: 1 addition & 1 deletion model_gateway/src/routers/http/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ impl Router {
self.client
.post(&endpoint_url)
.header(CONTENT_TYPE, HeaderValue::from_static("application/json")),
bytes::Bytes::from(body),
body,
);

request_builder = header_utils::apply_forwarded_request_headers(
Expand Down
20 changes: 17 additions & 3 deletions model_gateway/src/worker/http_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,15 @@ mod tests {
/// Loopback echo server; axum::serve accepts HTTP/1.1 and prior-knowledge
/// h2c on the same listener, mirroring a dual-protocol engine.
async fn spawn_echo_server() -> String {
let app = axum::Router::new().route("/probe", axum::routing::get(|| async { "ok" }));
let app = axum::Router::new()
.route("/probe", axum::routing::get(|| async { "ok" }))
.route(
"/hang",
axum::routing::get(|| async {
tokio::time::sleep(Duration::from_secs(3600)).await;
"late"
}),
);
let listener = tokio::net::TcpListener::bind("127.0.0.1:0")
.await
.expect("bind echo server");
Expand Down Expand Up @@ -281,14 +289,20 @@ mod tests {
async fn per_request_timeout_overrides_client_default() {
let url = spawn_echo_server().await;
// A zero client-level total timeout fails every request that relies
// on the client default...
// on the client default. Aim it at the hanging route: a fast local
// response can otherwise win the race against a zero-duration timer.
let hang_url = url.replace("/probe", "/hang");
let client = cache(RouterConfig {
request_timeout_secs: 0,
..RouterConfig::default()
})
.get(&HttpPoolConfig::default())
.expect("client");
let err = client.get(&url).send().await.expect_err("default applies");
let err = client
.get(&hang_url)
.send()
.await
.expect_err("default applies");
assert!(err.is_timeout());
// ...while a per-request timeout replaces it entirely.
let resp = client
Expand Down
Loading