Skip to content

Commit

Permalink
feat(read_handler): log when max hearbeat missed
Browse files Browse the repository at this point in the history
This can be useful when debugging if the limit was reached, otherwise
there is no easy way to tell.
  • Loading branch information
RoloEdits committed Oct 24, 2024
1 parent de3c858 commit 9395695
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions amqprs/src/net/reader_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ impl ReaderHandler {
match res {
Ok((channel_id, frame)) => {
if let Err(err) = self.handle_frame(channel_id, frame).await {
// notifiy network failure
// notify network failure
is_network_failure = true;
#[cfg(feature="traces")]
error!("socket will be closed due to error of handling frame, cause: {}", err);
Expand All @@ -275,7 +275,7 @@ impl ReaderHandler {
}
},
Err(err) => {
// notifiy network failure
// notify network failure
is_network_failure = true;
#[cfg(feature="traces")]
error!("socket will be closed due to failure of reading frame, cause: {}", err);
Expand All @@ -294,6 +294,8 @@ impl ReaderHandler {
error!("missing heartbeat from server for {}", self.amqp_connection);
heartbeat_miss += 1;
if heartbeat_miss >= MAX_HEARTBEAT_MISS {
#[cfg(feature="traces")]
error!("heartbeat was missed `{heartbeat_miss}` times in a row, closing connection");
// Shutdown connection due to heartbeat timeout
is_network_failure = true;
break;
Expand Down

0 comments on commit 9395695

Please sign in to comment.