From 264e35bbdd65541f6c26881cf521dda16b63e343 Mon Sep 17 00:00:00 2001 From: Niklas Date: Mon, 4 Apr 2022 16:25:50 +0100 Subject: [PATCH] fix: peers request metric --- network/src/peer.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/network/src/peer.rs b/network/src/peer.rs index f707c169ca..2bea04c1ed 100644 --- a/network/src/peer.rs +++ b/network/src/peer.rs @@ -434,6 +434,13 @@ impl Peer { is_ready_to_send } + Message::PeerResponse(_, _rtt_start) => { + // Stop the clock on internal RTT. + #[cfg(any(feature = "test", feature = "prometheus"))] + metrics::histogram!(metrics::internal_rtt::PEERS_REQUEST, _rtt_start.expect("rtt should be present with metrics enabled").elapsed()); + + true + } _ => true, }; // Send the message if it is ready. @@ -549,15 +556,11 @@ impl Peer { warn!("[PeerRequest] {}", error); } } - Message::PeerResponse(peer_ips, _rtt_start) => { + Message::PeerResponse(peer_ips, _) => { // Adds the given peer IPs to the list of candidate peers. if let Err(error) = peers_router.send(PeersRequest::ReceivePeerResponse(peer_ips)).await { warn!("[PeerResponse] {}", error); } - - // Stop the clock on internal RTT. - #[cfg(any(feature = "test", feature = "prometheus"))] - metrics::histogram!(metrics::internal_rtt::PEERS_REQUEST, _rtt_start.expect("rtt should be present with metrics enabled").elapsed()); } Message::Ping(version, fork_depth, node_type, status, block_hash, block_header) => { // Ensure the message protocol version is not outdated.