fix(tauri): Let watcher sleep even if we fail to get current swaps

This commit is contained in:
binarybaron 2024-10-09 16:46:29 +02:00
parent 8f33fe5b41
commit 119b8714ef

View file

@ -43,6 +43,8 @@ impl Watcher {
// Note: since this is de-facto a daemon, we have to gracefully handle errors // Note: since this is de-facto a daemon, we have to gracefully handle errors
// (which in our case means logging the error message and trying again later) // (which in our case means logging the error message and trying again later)
loop { loop {
tokio::time::sleep(Duration::from_secs(Watcher::CHECK_INTERVAL)).await;
// Fetch current transactions and timelocks // Fetch current transactions and timelocks
let current_swaps = match self.get_current_swaps().await { let current_swaps = match self.get_current_swaps().await {
Ok(val) => val, Ok(val) => val,
@ -82,9 +84,6 @@ impl Watcher {
// Insert new status // Insert new status
self.cached_timelocks.insert(swap_id, new_timelock_status); self.cached_timelocks.insert(swap_id, new_timelock_status);
} }
// Sleep and check again later
tokio::time::sleep(Duration::from_secs(Watcher::CHECK_INTERVAL)).await;
} }
} }