mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-30 02:55:22 +01:00
Merge pull request #601 from thesimplekid/reconnect_cln
fix: cln return error on stream
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user