Skip to content

Commit

Permalink
fix: log common errors once every minute
Browse files Browse the repository at this point in the history
  • Loading branch information
rumenov committed Feb 21, 2024
1 parent 8ac2766 commit 0412fb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion rs/p2p/quic_transport/src/connection_manager.rs
Expand Up @@ -592,7 +592,7 @@ impl ConnectionManager {
.close(VarInt::from_u32(0), b"using newer connection");
info!(
self.log,
"Replacing old connection to {} with newer", peer_id
"Replacing old connection to {} with newer", peer_id
);
} else {
self.metrics.peer_map_size.inc();
Expand Down
8 changes: 4 additions & 4 deletions rs/p2p/quic_transport/src/request_handler.rs
Expand Up @@ -136,7 +136,7 @@ async fn handle_bi_stream(
let mut request = match read_request(bi_rx).await {
Ok(request) => request,
Err(e) => {
info!(log, "Failed to read request from bidi stream: {}", e);
info!(every_n_seconds => 60, log, "Failed to read request from bidi stream: {}", e);
metrics
.request_handle_errors_total
.with_label_values(&[STREAM_TYPE_BIDI, ERROR_TYPE_READ])
Expand Down Expand Up @@ -169,14 +169,14 @@ async fn handle_bi_stream(
// if the other peer has closed the connection. In this case `accept_bi` in the peer event
// loop will close this connection.
if let Err(e) = write_response(&mut bi_tx, response).await {
info!(log, "Failed to write response to stream: {}", e);
info!(every_n_seconds => 60, log, "Failed to write response to stream: {}", e);
metrics
.request_handle_errors_total
.with_label_values(&[STREAM_TYPE_BIDI, ERROR_TYPE_WRITE])
.inc();
}
if let Err(e) = bi_tx.finish().await {
info!(log, "Failed to finish stream: {}", e.to_string());
info!(every_n_seconds => 60, log, "Failed to finish stream: {}", e.to_string());
metrics
.request_handle_errors_total
.with_label_values(&[STREAM_TYPE_BIDI, ERROR_TYPE_FINISH])
Expand All @@ -195,7 +195,7 @@ async fn handle_uni_stream(
let mut request = match read_request(uni_rx).await {
Ok(request) => request,
Err(e) => {
info!(log, "Failed to read request from uni stream: {}", e);
info!(every_n_seconds => 60, log, "Failed to read request from uni stream: {}", e);
metrics
.request_handle_errors_total
.with_label_values(&[STREAM_TYPE_UNI, ERROR_TYPE_READ])
Expand Down

0 comments on commit 0412fb6

Please sign in to comment.