Skip to content

Commit

Permalink
put term 'hibernation' in all reconnect logs
Browse files Browse the repository at this point in the history
  • Loading branch information
JssDWt committed Oct 29, 2024
1 parent 696ca0e commit 6eb51d6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
11 changes: 7 additions & 4 deletions libs/sdk-core/src/breez_services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,10 @@ impl BreezServices {
.saturating_sub(DETECT_HIBERNATE_SLEEP_DURATION)
.ge(&DETECT_HIBERNATE_MAX_OFFSET)
{
debug!("Hibernation detected, notifying services.");
debug!(
"Hibernation detected with duration {}s, notifying services.",
elapsed.as_secs_f32()
);
let _ = cloned.hibernation_sender.send(());
}
}
Expand Down Expand Up @@ -1694,7 +1697,7 @@ impl BreezServices {
}

_ = reconnect_receiver.changed() => {
debug!("Reconnect track invoices");
debug!("Reconnect hibernation: track invoices");
break;
}
}
Expand Down Expand Up @@ -1740,7 +1743,7 @@ impl BreezServices {
}

_ = reconnect_receiver.changed() => {
debug!("Reconnect track logs");
debug!("Reconnect hibernation: track logs");
break;
}
}
Expand Down Expand Up @@ -2444,7 +2447,7 @@ impl BreezServicesBuilder {
return;
}

debug!("reconnecting breez server");
debug!("Reconnect hibernation: breez server");
let _ = cloned_breez_server.reconnect().await;
}
});
Expand Down
12 changes: 6 additions & 6 deletions libs/sdk-core/src/greenlight/node_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,28 +197,28 @@ impl Greenlight {
tokio::spawn(async move {
loop {
if let Err(e) = reconnect_receiver.changed().await {
debug!("reconnect receiver dropped: {:?}", e);
debug!("Reconnect hibernation receiver dropped: {:?}", e);
return;
}

debug!("reconnect: request received");
debug!("Reconnect hibernation: request received");

// Force refresh existing grpc clients
*cloned.gl_client.lock().await = None;
*cloned.node_client.lock().await = None;

// Shutdown the existing signer
debug!("reconnect: shutting down old signer");
debug!("Reconnect hibernation: shutting down old signer");
let _ = cloned.internal_shutdown.lock().await.send(()).await;

// Create a new signer
debug!("creating new signer");
debug!("Reconnect hibernation: creating new signer");
let new_signer = match Signer::new(seed.clone(), greenlight_network, device.clone())
{
Ok(new_signer) => new_signer,
Err(e) => {
error!(
"failed to create new signer after reconnect request: {:?}",
"Reconnect hibernation: failed to create new signer after reconnect request: {:?}",
e
);
continue;
Expand All @@ -228,7 +228,7 @@ impl Greenlight {

// Start the new signer if the previous one was started.
if cloned.external_shutdown.lock().await.is_some() {
debug!("reconnect: starting new signer");
debug!("Reconnect hibernation: starting new signer");
cloned.do_start_signer().await;
}
}
Expand Down

0 comments on commit 6eb51d6

Please sign in to comment.