Skip to content

Commit

Permalink
Changed some log messages to make it clearer when sidecar looses conn…
Browse files Browse the repository at this point in the history
…ection to node and attempts reconnect (#222)

Co-authored-by: Jakub Zajkowski <[email protected]>
  • Loading branch information
zajko and Jakub Zajkowski authored Nov 23, 2023
1 parent 1ef43c3 commit 89e3c8e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions listener/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use tokio::{
},
time::sleep,
};
use tracing::{debug, error, info};
use tracing::{debug, error, info, warn};
pub use types::{NodeConnectionInterface, SseEvent};
use url::Url;

Expand Down Expand Up @@ -160,8 +160,8 @@ impl EventListener {
current_attempt: usize,
) -> Result<Option<ProtocolVersion>, BuildVersionFetchError> {
info!(
"Attempting to connect...\t{}/{}",
current_attempt, self.max_connection_attempts
"Attempting to connect {} \t{}/{}",
self.node.ip_address, current_attempt, self.max_connection_attempts
);
match self.fetch_build_version_from_status().await {
Ok(version) => {
Expand Down Expand Up @@ -224,7 +224,13 @@ impl EventListener {
)
.await?
{
ConnectOutcome::ConnectionLost => current_attempt += 1,
ConnectOutcome::ConnectionLost => {
current_attempt += 1;
warn!(
"Lost connection to node {}, on attempt {}/{}",
self.node.ip_address, current_attempt, self.max_connection_attempts
);
}
ConnectOutcome::SystemReconnect => {}
};
sleep(Duration::from_secs(1)).await;
Expand Down

0 comments on commit 89e3c8e

Please sign in to comment.