♻️ refactor: use `tokio::time::timeout`
parent
a661ce02ea
commit
33d07c45a8
|
@ -144,14 +144,13 @@ async fn handle_http_request (
|
||||||
|
|
||||||
state.park_client (server_name, req, &req_id).await;
|
state.park_client (server_name, req, &req_id).await;
|
||||||
|
|
||||||
let timeout = tokio::time::sleep (std::time::Duration::from_secs (30));
|
let received = match tokio::time::timeout (Duration::from_secs (30), rx).await
|
||||||
|
{
|
||||||
let received = tokio::select! {
|
Ok (x) => x,
|
||||||
val = rx => val,
|
Err (_) => {
|
||||||
() = timeout => {
|
|
||||||
debug! ("Timed out request {}", req_id);
|
debug! ("Timed out request {}", req_id);
|
||||||
return error_reply (StatusCode::GATEWAY_TIMEOUT, "Remote server never responded")
|
return error_reply (StatusCode::GATEWAY_TIMEOUT, "Remote server never responded");
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// UKAUFFY4 (Receive half)
|
// UKAUFFY4 (Receive half)
|
||||||
|
|
Loading…
Reference in New Issue