Add more logging of states

unused/TracingSupport
Chip Senkbeil 11 months ago
parent 3ac715eadd
commit f45c90bf39
No known key found for this signature in database
GPG Key ID: 35EF1F8EC72A4131

@ -212,6 +212,9 @@ impl UntypedClient {
// down.
let _shutdown_tx = shutdown_tx_2;
// Keep track of block status so we can log appropriately
let mut was_blocked = false;
loop {
// If we have flagged that a reconnect is needed, attempt to do so
if needs_reconnect {
@ -395,6 +398,18 @@ impl UntypedClient {
// If we did not read or write anything, sleep a bit to offload CPU usage
if read_blocked && write_blocked {
tokio::time::sleep(SLEEP_DURATION).await;
if !was_blocked {
trace!("Client entering blocked state");
}
was_blocked = true;
} else {
if was_blocked {
trace!("Client exiting blocked state");
}
was_blocked = false;
}
}
});

@ -462,6 +462,9 @@ where
// Store our connection details
state.connections.write().await.insert(id, connection_state);
// Keep track of block status so we can log appropriately
let mut was_blocked = false;
debug!("[Conn {id}] Beginning read/write loop");
loop {
let ready = match await_or_shutdown!(
@ -583,6 +586,18 @@ where
// If we did not read or write anything, sleep a bit to offload CPU usage
if read_blocked && write_blocked {
tokio::time::sleep(sleep_duration).await;
if !was_blocked {
trace!("[Conn {id}] Entering blocked state");
}
was_blocked = true;
} else {
if was_blocked {
trace!("[Conn {id}] Exiting blocked state");
}
was_blocked = false;
}
}
}

Loading…
Cancel
Save