From d2b05fd57e9c8ffd7675255cd5e9628d2a97e79d Mon Sep 17 00:00:00 2001 From: tecnovert Date: Wed, 10 Nov 2021 12:44:40 +0200 Subject: [PATCH] coins: Add startup_tries setting --- basicswap/basicswap.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/basicswap/basicswap.py b/basicswap/basicswap.py index 2cfc57d..d7076c7 100644 --- a/basicswap/basicswap.py +++ b/basicswap/basicswap.py @@ -187,6 +187,7 @@ class BasicSwap(BaseApp): self.check_expired_seconds = self.settings.get('check_expired_seconds', 60 * 5) self.check_events_seconds = self.settings.get('check_events_seconds', 10) self.check_xmr_swaps_seconds = self.settings.get('check_xmr_swaps_seconds', 20) + self.startup_tries = self.settings.get('startup_tries', 21) # Seconds waited for will be (x(1 + x+1) / 2 self._last_checked_progress = 0 self._last_checked_watched = 0 self._last_checked_expired = 0 @@ -196,6 +197,7 @@ class BasicSwap(BaseApp): self._updating_wallets_info = {} self._last_updated_wallets_info = 0 + # TODO: Adjust ranges self.min_delay_event = self.settings.get('min_delay_event', 10) self.max_delay_event = self.settings.get('max_delay_event', 60) @@ -606,7 +608,7 @@ class BasicSwap(BaseApp): raise ValueError('Unable to upgrade database.') def waitForDaemonRPC(self, coin_type): - for i in range(21): + for i in range(self.startup_tries): if not self.is_running: return try: @@ -616,7 +618,7 @@ class BasicSwap(BaseApp): self.log.warning('Can\'t connect to %s RPC: %s. Trying again in %d second/s.', coin_type, str(ex), (1 + i)) time.sleep(1 + i) self.log.error('Can\'t connect to %s RPC, exiting.', coin_type) - self.stopRunning(1) # systemd will try restart if fail_code != 0 + self.stopRunning(1) # systemd will try to restart the process if fail_code != 0 def checkSynced(self, coin_from, coin_to): check_coins = (coin_from, coin_to)