From 119b8714efde15ec07cd075aa9348c2e78da9d26 Mon Sep 17 00:00:00 2001 From: binarybaron Date: Wed, 9 Oct 2024 16:46:29 +0200 Subject: [PATCH] fix(tauri): Let watcher sleep even if we fail to get current swaps --- swap/src/cli/watcher.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/swap/src/cli/watcher.rs b/swap/src/cli/watcher.rs index 9edd67d6..cc23082c 100644 --- a/swap/src/cli/watcher.rs +++ b/swap/src/cli/watcher.rs @@ -43,6 +43,8 @@ impl Watcher { // 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) loop { + tokio::time::sleep(Duration::from_secs(Watcher::CHECK_INTERVAL)).await; + // Fetch current transactions and timelocks let current_swaps = match self.get_current_swaps().await { Ok(val) => val, @@ -82,9 +84,6 @@ impl Watcher { // Insert new 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; } }