Skip to content

Commit

Permalink
fix: change the status code emitted when an idle timeout occurs for a…
Browse files Browse the repository at this point in the history
… worker (#349)

* fix: change the status code emitted when an idle timeout occurs for a worker

* stamp: missing changes
  • Loading branch information
nyannyacha committed May 23, 2024
1 parent 85b5c4e commit 8ff5c47
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions crates/base/src/rt_worker/worker_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ async fn handle_request(
let res = tokio::select! {
resp = request_sender.send_request(req) => resp,
_ = maybe_cancel_fut => {
// XXX(Nyannyacha): Should we add a more detailed message?
Ok(emit_status_code(http::StatusCode::REQUEST_TIMEOUT, None, true))
Ok(emit_status_code(http::StatusCode::GATEWAY_TIMEOUT, None, false))
}
};

Expand Down
2 changes: 1 addition & 1 deletion crates/base/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1701,7 +1701,7 @@ async fn test_request_idle_timeout_no_streamed_response(maybe_tls: Option<Tls>)
request_builder,
maybe_tls,
(|resp| async {
assert_eq!(resp.unwrap().status().as_u16(), StatusCode::REQUEST_TIMEOUT);
assert_eq!(resp.unwrap().status().as_u16(), StatusCode::GATEWAY_TIMEOUT);
}),
TerminationToken::new()
);
Expand Down

0 comments on commit 8ff5c47

Please sign in to comment.