Skip to content

Commit

Permalink
Reduce chatty warnings in network and replication services
Browse files Browse the repository at this point in the history
  • Loading branch information
sandreae committed Jul 26, 2023
1 parent ecc2955 commit 38711ea
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
20 changes: 10 additions & 10 deletions aquadoggo/src/network/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,15 @@ impl EventLoop {
send_back_addr,
..
} => {
warn!("Incoming connection error occurred with {local_addr} and {send_back_addr} on connection {connection_id:?}");
debug!("Incoming connection error occurred with {local_addr} and {send_back_addr} on connection {connection_id:?}");

Check warning on line 299 in aquadoggo/src/network/service.rs

View check run for this annotation

Codecov / codecov/patch

aquadoggo/src/network/service.rs#L299

Added line #L299 was not covered by tests
}
SwarmEvent::ListenerClosed {
listener_id,
addresses,
reason,
} => trace!("Listener closed: {listener_id:?} {addresses:?} {reason:?}"),
SwarmEvent::ListenerError { error, .. } => {
warn!("Listener failed with error: {error}")
debug!("Listener failed with error: {error}")

Check warning on line 307 in aquadoggo/src/network/service.rs

View check run for this annotation

Codecov / codecov/patch

aquadoggo/src/network/service.rs#L307

Added line #L307 was not covered by tests
}
SwarmEvent::NewListenAddr {
address,
Expand All @@ -318,10 +318,10 @@ impl EventLoop {
..
} => match peer_id {
Some(id) => {
warn!("Outgoing connection error with peer {id} occurred on connection {connection_id:?}");
debug!("Outgoing connection error with peer {id} occurred on connection {connection_id:?}");

Check warning on line 321 in aquadoggo/src/network/service.rs

View check run for this annotation

Codecov / codecov/patch

aquadoggo/src/network/service.rs#L321

Added line #L321 was not covered by tests
}
None => {
warn!("Outgoing connection error occurred on connection {connection_id:?}");
debug!("Outgoing connection error occurred on connection {connection_id:?}");

Check warning on line 324 in aquadoggo/src/network/service.rs

View check run for this annotation

Codecov / codecov/patch

aquadoggo/src/network/service.rs#L324

Added line #L324 was not covered by tests
}
},

Expand Down Expand Up @@ -381,7 +381,7 @@ impl EventLoop {
}
}
rendezvous::client::Event::RegisterFailed { error, .. } => {
warn!("Failed to register with rendezvous point: {error:?}");
debug!("Failed to register with rendezvous point: {error:?}");

Check warning on line 384 in aquadoggo/src/network/service.rs

View check run for this annotation

Codecov / codecov/patch

aquadoggo/src/network/service.rs#L384

Added line #L384 was not covered by tests
}
rendezvous::client::Event::DiscoverFailed { error, .. } => {
trace!("Discovery failed: {error:?}")
Expand Down Expand Up @@ -433,7 +433,7 @@ impl EventLoop {
) {
Ok(_) => (),
Err(_) => {
warn!("Failed to register peer: {rendezvous_peer_id}")
debug!("Failed to register peer: {rendezvous_peer_id}")

Check warning on line 436 in aquadoggo/src/network/service.rs

View check run for this annotation

Codecov / codecov/patch

aquadoggo/src/network/service.rs#L436

Added line #L436 was not covered by tests
}
};
}
Expand All @@ -445,7 +445,7 @@ impl EventLoop {
)
}
identify::Event::Error { peer_id, error } => {
warn!("Failed to identify the remote peer {peer_id}: {error}")
debug!("Failed to identify the remote peer {peer_id}: {error}")

Check warning on line 448 in aquadoggo/src/network/service.rs

View check run for this annotation

Codecov / codecov/patch

aquadoggo/src/network/service.rs#L448

Added line #L448 was not covered by tests
}
}
}
Expand Down Expand Up @@ -485,7 +485,7 @@ impl EventLoop {
) {
Ok(_) => (),
Err(_) => {
warn!("Failed to register peer: {rendezvous_peer_id}")
debug!("Failed to register peer: {rendezvous_peer_id}")

Check warning on line 488 in aquadoggo/src/network/service.rs

View check run for this annotation

Codecov / codecov/patch

aquadoggo/src/network/service.rs#L488

Added line #L488 was not covered by tests
}
};
}
Expand Down Expand Up @@ -531,8 +531,8 @@ impl EventLoop {
.condition(PeerCondition::NotDialing)
.build(),
) {
Ok(_) => debug!("Dialing peer: {peer_id}"),
Err(_) => warn!("Error dialing peer: {peer_id}"),
Ok(()) => debug!("Dialing peer: {peer_id}"),
Err(error) => debug!("Error dialing peer {peer_id}: {error}"),

Check warning on line 535 in aquadoggo/src/network/service.rs

View check run for this annotation

Codecov / codecov/patch

aquadoggo/src/network/service.rs#L534-L535

Added lines #L534 - L535 were not covered by tests
};
}
},
Expand Down
2 changes: 1 addition & 1 deletion aquadoggo/src/replication/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ where
{
sessions.remove(index);
} else {
warn!(
debug!(

Check warning on line 134 in aquadoggo/src/replication/manager.rs

View check run for this annotation

Codecov / codecov/patch

aquadoggo/src/replication/manager.rs#L134

Added line #L134 was not covered by tests
"Tried to remove nonexistent session {} with peer: {}",
session_id,
remote_peer.display()
Expand Down
8 changes: 6 additions & 2 deletions aquadoggo/src/replication/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::time::Duration;

use anyhow::Result;
use libp2p::PeerId;
use log::{info, trace, warn};
use log::{debug, info, trace, warn};
use p2panda_rs::schema::SchemaId;
use p2panda_rs::Human;
use tokio::task;
Expand Down Expand Up @@ -217,7 +217,11 @@ impl ConnectionManager {
session_id: SessionId,
error: ReplicationError,
) {
warn!("Replication with peer {} failed: {}", peer.display(), error);
if let ReplicationError::NoSessionFound(_, _) = error {
debug!("Replication session not found: {}", error);

Check warning on line 221 in aquadoggo/src/replication/service.rs

View check run for this annotation

Codecov / codecov/patch

aquadoggo/src/replication/service.rs#L220-L221

Added lines #L220 - L221 were not covered by tests
} else {
warn!("Replication failed: {}", error);

Check warning on line 223 in aquadoggo/src/replication/service.rs

View check run for this annotation

Codecov / codecov/patch

aquadoggo/src/replication/service.rs#L223

Added line #L223 was not covered by tests
}

match self.peers.get_mut(&peer) {
Some(status) => {
Expand Down

0 comments on commit 38711ea

Please sign in to comment.