add listen ID to http_listen

main
_ 2021-03-16 15:15:16 +00:00
parent 3302411daa
commit 453532e48e
2 changed files with 6 additions and 4 deletions

View File

@ -441,7 +441,7 @@ async fn handle_all (
let path = req.uri ().path ().to_string (); let path = req.uri ().path ().to_string ();
//println! ("{}", path); //println! ("{}", path);
debug! ("Request path: {}", path); trace! ("Request path: {}", path);
if req.method () == Method::POST { if req.method () == Method::POST {
// This is stuff the server can use. Clients can't // This is stuff the server can use. Clients can't

View File

@ -99,6 +99,8 @@ pub async fn handle_listen (
let (tx, rx) = oneshot::channel (); let (tx, rx) = oneshot::channel ();
let listen_id = ulid::Ulid::new ().to_string ();
{ {
let mut request_rendezvous = state.request_rendezvous.lock ().await; let mut request_rendezvous = state.request_rendezvous.lock ().await;
@ -113,7 +115,7 @@ pub async fn handle_listen (
} }
} }
trace! ("Parking server {}", watcher_code); debug! ("Parking server {}, listen id {}", watcher_code, listen_id);
request_rendezvous.insert (watcher_code.clone (), ParkedServer (tx)); request_rendezvous.insert (watcher_code.clone (), ParkedServer (tx));
} }
@ -127,12 +129,12 @@ pub async fn handle_listen (
}, },
Ok (Err (ShuttingDownError::ShuttingDown)) => Ok (error_reply (StatusCode::SERVICE_UNAVAILABLE, "Server is shutting down, try again soon")?), Ok (Err (ShuttingDownError::ShuttingDown)) => Ok (error_reply (StatusCode::SERVICE_UNAVAILABLE, "Server is shutting down, try again soon")?),
Err (e) => { Err (e) => {
error! ("{} {}", watcher_code, e); error! ("{} {} {}", watcher_code, listen_id, e);
Ok (error_reply (StatusCode::INTERNAL_SERVER_ERROR, "Server error")?) Ok (error_reply (StatusCode::INTERNAL_SERVER_ERROR, "Server error")?)
}, },
}, },
_ = tokio::time::sleep (Duration::from_secs (30)).fuse () => { _ = tokio::time::sleep (Duration::from_secs (30)).fuse () => {
trace! ("Timed out http_listen for server {}", watcher_code); debug! ("Timed out http_listen for server {} {}", watcher_code, listen_id);
return Ok (error_reply (StatusCode::NO_CONTENT, "No requests now, long-poll again")?) return Ok (error_reply (StatusCode::NO_CONTENT, "No requests now, long-poll again")?)
} }
} }