🐛 bug: ptth_server: add 30-second timeout for _only_ http_listen requests

main
_ 2021-04-02 20:58:19 -05:00
parent 7172f3e1a2
commit 6ee9b6e7c9
2 changed files with 4 additions and 2 deletions

View File

@ -133,7 +133,7 @@ pub async fn handle_listen (
Ok (error_reply (StatusCode::INTERNAL_SERVER_ERROR, "Server error")?)
},
},
_ = tokio::time::sleep (Duration::from_secs (30)).fuse () => {
_ = tokio::time::sleep (Duration::from_secs (25)).fuse () => {
debug! ("Timed out http_listen for server {} {}", watcher_code, listen_id);
return Ok (error_reply (StatusCode::NO_CONTENT, "No requests now, long-poll again")?)
}

View File

@ -294,7 +294,9 @@ async fn run_server_loop (
debug! ("http_listen");
let req_req = state.client.get (&format! ("{}/http_listen/{}", state.config.relay_url, state.file_server.metrics_startup.server_name)).send ();
let req_req = state.client.get (&format! ("{}/http_listen/{}", state.config.relay_url, state.file_server.metrics_startup.server_name))
.timeout (Duration::from_secs (30))
.send ();
let err_backoff_delay = std::cmp::min (30_000, backoff_delay * 2 + 500);