mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 12:17:58 +00:00
Further reduce the CPU overhead of networking metrics (#10875)
* Simplify `num_connected_peers` * Track requested peer counts * Revert "Track requested peer counts" This reverts commit 9f1c8704353df6afc17ed7e9f4ab8d8e29466ae4. * Remove `substrate_sub_libp2p_peerset_num_requested` metric * Remove two unused functions that I forgot to get rid of in previous commit
This commit is contained in:
@@ -251,16 +251,6 @@ impl PeerState {
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// True if that node has been requested by the PSM.
|
||||
fn is_requested(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
Self::PendingRequest { .. } |
|
||||
Self::Requested | Self::DisabledPendingEnable { .. } |
|
||||
Self::Enabled { .. }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// State of the handler of a single connection visible from this state machine.
|
||||
@@ -560,17 +550,6 @@ impl Notifications {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the list of all the peers that the peerset currently requests us to be connected to.
|
||||
pub fn requested_peers<'a>(
|
||||
&'a self,
|
||||
set_id: sc_peerset::SetId,
|
||||
) -> impl Iterator<Item = &'a PeerId> + 'a {
|
||||
self.peers
|
||||
.iter()
|
||||
.filter(move |((_, set), state)| *set == set_id && state.is_requested())
|
||||
.map(|((id, _), _)| id)
|
||||
}
|
||||
|
||||
/// Returns the list of reserved peers.
|
||||
pub fn reserved_peers<'a>(
|
||||
&'a self,
|
||||
|
||||
Reference in New Issue
Block a user