Merge pull request #601 from thesimplekid/reconnect_cln

fix: cln return error on stream
This commit is contained in:
thesimplekid
2025-02-13 10:40:53 +00:00
committed by GitHub
2 changed files with 3 additions and 5 deletions

View File

@@ -8,7 +8,6 @@ use std::pin::Pin;
use std::str::FromStr;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::time::Duration;
use async_trait::async_trait;
use cdk::amount::{to_unit, Amount, MSAT_IN_SAT};
@@ -162,8 +161,8 @@ impl MintLightning for Cln {
}
Err(e) => {
tracing::warn!("Error fetching invoice: {e}");
tokio::time::sleep(Duration::from_secs(1)).await;
continue;
is_active.store(false, Ordering::SeqCst);
return None;
}
}
}

View File

@@ -228,7 +228,6 @@ impl Mint {
let shutdown = Arc::clone(&shutdown);
let key = key.clone();
join_set.spawn(async move {
if !ln.is_wait_invoice_active() {
loop {
tokio::select! {
_ = shutdown.notified() => {
@@ -247,12 +246,12 @@ impl Mint {
}
Err(err) => {
tracing::warn!("Could not get invoice stream for {:?}: {}",key, err);
tokio::time::sleep(std::time::Duration::from_secs(5)).await;
}
}
}
}
}
}
});
}