add listen ID to http_listen
parent
3302411daa
commit
453532e48e
|
@ -441,7 +441,7 @@ async fn handle_all (
|
|||
let path = req.uri ().path ().to_string ();
|
||||
//println! ("{}", path);
|
||||
|
||||
debug! ("Request path: {}", path);
|
||||
trace! ("Request path: {}", path);
|
||||
|
||||
if req.method () == Method::POST {
|
||||
// This is stuff the server can use. Clients can't
|
||||
|
|
|
@ -99,6 +99,8 @@ pub async fn handle_listen (
|
|||
|
||||
let (tx, rx) = oneshot::channel ();
|
||||
|
||||
let listen_id = ulid::Ulid::new ().to_string ();
|
||||
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -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")?),
|
||||
Err (e) => {
|
||||
error! ("{} {}", watcher_code, e);
|
||||
error! ("{} {} {}", watcher_code, listen_id, e);
|
||||
Ok (error_reply (StatusCode::INTERNAL_SERVER_ERROR, "Server error")?)
|
||||
},
|
||||
},
|
||||
_ = 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")?)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue