Skip to content

Commit

Permalink
chore: remove expensive fmting of event
Browse files Browse the repository at this point in the history
  • Loading branch information
stringhandler committed Dec 19, 2024
1 parent e25b29a commit be1abd4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/server/p2p/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,8 @@ where S: ShareChain
request: DirectPeerInfoRequest,
) {
if request.my_info.version != PROTOCOL_VERSION {
debug!(target: LOG_TARGET, squad = &self.config.squad; "Peer {} has an outdated version, skipping", request.peer_id);
// debug!(target: LOG_TARGET, squad = &self.config.squad; "Peer {} has an outdated version, skipping",
// request.peer_id);
let _unused = self
.swarm
.behaviour_mut()
Expand Down Expand Up @@ -2268,11 +2269,9 @@ where S: ShareChain
},
event = self.swarm.select_next_some() => {
let timer = Instant::now();
let mut event_string = format!("{:?}", event);
event_string.truncate(300);
self.handle_event(event).await;
if timer.elapsed() > MAX_ACCEPTABLE_NETWORK_EVENT_TIMEOUT {
warn!(target: LOG_TARGET, "Event handling took too long: {:?} ({})", timer.elapsed(),event_string);
warn!(target: LOG_TARGET, "Event handling took too long: {:?}", timer.elapsed());
}
},
_ = publish_peer_info_interval.tick() => {
Expand Down

0 comments on commit be1abd4

Please sign in to comment.