♻️ 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;
|
||||
|
||||
let timeout = tokio::time::sleep (std::time::Duration::from_secs (30));
|
||||
|
||||
let received = tokio::select! {
|
||||
val = rx => val,
|
||||
() = timeout => {
|
||||
let received = match tokio::time::timeout (Duration::from_secs (30), rx).await
|
||||
{
|
||||
Ok (x) => x,
|
||||
Err (_) => {
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue