From d879a6e97339afeba1c433e09012989a27a5e298 Mon Sep 17 00:00:00 2001 From: teor Date: Mon, 8 Feb 2021 13:28:25 +1000 Subject: [PATCH] Update PeerSet metrics after every change --- zebra-network/src/peer_set/set.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zebra-network/src/peer_set/set.rs b/zebra-network/src/peer_set/set.rs index e2b8b70e44d..eb756fb4d49 100644 --- a/zebra-network/src/peer_set/set.rs +++ b/zebra-network/src/peer_set/set.rs @@ -446,6 +446,7 @@ where trace!("preselected service was not ready, reselecting"); self.preselected_p2c_index = self.preselect_p2c_index(); + self.update_metrics(); if self.preselected_p2c_index.is_none() { trace!("no ready services, sending demand signal"); @@ -456,7 +457,7 @@ where } fn call(&mut self, req: Request) -> Self::Future { - match req { + let fut = match req { // Only do inventory-aware routing on individual items. Request::BlocksByHash(ref hashes) if hashes.len() == 1 => { let hash = InventoryHash::from(*hashes.iter().next().unwrap()); @@ -469,6 +470,9 @@ where Request::AdvertiseTransactions(_) => self.route_all(req), Request::AdvertiseBlock(_) => self.route_all(req), _ => self.route_p2c(req), - } + }; + self.update_metrics(); + + fut } }