mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 01:07:57 +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:
@@ -465,12 +465,6 @@ impl<B: BlockT> Protocol<B> {
|
||||
self.behaviour.open_peers()
|
||||
}
|
||||
|
||||
/// Returns the list of all the peers that the peerset currently requests us to be connected
|
||||
/// to on the default set.
|
||||
pub fn requested_peers(&self) -> impl Iterator<Item = &PeerId> {
|
||||
self.behaviour.requested_peers(HARDCODED_PEERSETS_SYNC)
|
||||
}
|
||||
|
||||
/// Returns the number of discovered nodes that we keep in memory.
|
||||
pub fn num_discovered_peers(&self) -> usize {
|
||||
self.behaviour.num_discovered_peers()
|
||||
@@ -496,7 +490,7 @@ impl<B: BlockT> Protocol<B> {
|
||||
|
||||
/// Returns the number of peers we're connected to.
|
||||
pub fn num_connected_peers(&self) -> usize {
|
||||
self.peers.values().count()
|
||||
self.peers.len()
|
||||
}
|
||||
|
||||
/// Returns the number of peers we're connected to and that are being queried.
|
||||
|
||||
Reference in New Issue
Block a user