Skip to content

Commit

Permalink
reconnect background tasks on hibernation
Browse files Browse the repository at this point in the history
  • Loading branch information
JssDWt committed Oct 29, 2024
1 parent 23c95fe commit 4f16bd6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libs/sdk-core/src/breez_services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1651,6 +1651,7 @@ impl BreezServices {
let cloned = self.clone();
tokio::spawn(async move {
let mut shutdown_receiver = cloned.shutdown_receiver.clone();
let mut reconnect_receiver = cloned.hibernation_receiver.clone();
loop {
if shutdown_receiver.has_changed().unwrap_or(true) {
return;
Expand Down Expand Up @@ -1704,6 +1705,11 @@ impl BreezServices {
debug!("Invoice tracking task has completed");
return;
}

_ = reconnect_receiver.changed() => {
debug!("Reconnect hibernation: track invoices");
break;
}
}
}
}
Expand All @@ -1716,6 +1722,7 @@ impl BreezServices {
let cloned = self.clone();
tokio::spawn(async move {
let mut shutdown_receiver = cloned.shutdown_receiver.clone();
let mut reconnect_receiver = cloned.hibernation_receiver.clone();
loop {
if shutdown_receiver.has_changed().unwrap_or(true) {
return;
Expand Down Expand Up @@ -1744,6 +1751,11 @@ impl BreezServices {
debug!("Track logs task has completed");
return;
}

_ = reconnect_receiver.changed() => {
debug!("Reconnect hibernation: track logs");
break;
}
}
}
}
Expand Down

0 comments on commit 4f16bd6

Please sign in to comment.