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:
Koute
2022-02-18 21:35:43 +09:00
committed by GitHub
parent 2777d4a154
commit b9a20ce86b
4 changed files with 1 additions and 37 deletions
+1 -7
View File
@@ -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.