Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Commit

Permalink
fix(network): negative connecting metric number (#430)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroqn authored Aug 24, 2020
1 parent c80355d commit dae62ae
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions core/network/src/peer_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,8 @@ impl PeerManager {
}

fn new_unidentified_session(&mut self, pubkey: PublicKey, ctx: Arc<SessionContext>) {
common_apm::metrics::network::NETWORK_OUTBOUND_CONNECTING_PEERS.dec();
common_apm::metrics::network::NETWORK_OUTBOUND_CONNECTING_PEERS
.set(self.connecting.len() as i64);

let peer_id = pubkey.peer_id();
if let Err(err) = self.new_session_pre_check(&pubkey, &ctx) {
Expand Down Expand Up @@ -976,7 +977,8 @@ impl PeerManager {
attempt.peer.set_connectedness(Connectedness::Unconnectable);
}

common_apm::metrics::network::NETWORK_OUTBOUND_CONNECTING_PEERS.dec();
common_apm::metrics::network::NETWORK_OUTBOUND_CONNECTING_PEERS
.set(self.connecting.len() as i64);
// FIXME
// if let Some(trust_metric) = attempt.peer.trust_metric() {
// trust_metric.bad_events(1);
Expand Down Expand Up @@ -1489,10 +1491,10 @@ impl Future for PeerManager {
);

if !connectable_peers.is_empty() {
common_apm::metrics::network::NETWORK_OUTBOUND_CONNECTING_PEERS
.add(connectable_peers.len() as i64);

self.connect_peers(connectable_peers);

common_apm::metrics::network::NETWORK_OUTBOUND_CONNECTING_PEERS
.set(self.connecting.len() as i64);
}
}

Expand Down

0 comments on commit dae62ae

Please sign in to comment.