From 0a432d081dbdfce72e11751e080a941e24dd04ff Mon Sep 17 00:00:00 2001 From: edouard Date: Thu, 31 Aug 2023 15:20:49 +0200 Subject: [PATCH] limit retry to loader stop --- gui/src/loader.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gui/src/loader.rs b/gui/src/loader.rs index b8278415..b788314f 100644 --- a/gui/src/loader.rs +++ b/gui/src/loader.rs @@ -163,12 +163,12 @@ impl Loader { ) -> Command { match res { Ok((daemon, bitcoind)) => { - self.waiting_daemon_bitcoind = false; // bitcoind may have been already started and given to the loader // We should not override with None the loader bitcoind field if let Some(bitcoind) = bitcoind { self.internal_bitcoind = Some(bitcoind); } + self.waiting_daemon_bitcoind = false; self.step = Step::Syncing { daemon: daemon.clone(), progress: 0.0, @@ -232,10 +232,10 @@ impl Loader { } else if self.waiting_daemon_bitcoind && self.gui_config.start_internal_bitcoind { if let Ok(config) = Config::from_file(self.gui_config.daemon_config_path.clone()) { if let Some(bitcoind_config) = &config.bitcoind_config { - let mut stopped = false; - while !stopped { - stopped = stop_bitcoind(bitcoind_config); - std::thread::sleep(std::time::Duration::from_secs(1)) + let mut retry = 0; + while !stop_bitcoind(bitcoind_config) && retry < 10 { + std::thread::sleep(std::time::Duration::from_millis(500)); + retry += 1; } } }