coins: Add startup_tries setting
This commit is contained in:
parent
b8ea028d04
commit
d2b05fd57e
@ -187,6 +187,7 @@ class BasicSwap(BaseApp):
|
|||||||
self.check_expired_seconds = self.settings.get('check_expired_seconds', 60 * 5)
|
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_events_seconds = self.settings.get('check_events_seconds', 10)
|
||||||
self.check_xmr_swaps_seconds = self.settings.get('check_xmr_swaps_seconds', 20)
|
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_progress = 0
|
||||||
self._last_checked_watched = 0
|
self._last_checked_watched = 0
|
||||||
self._last_checked_expired = 0
|
self._last_checked_expired = 0
|
||||||
@ -196,6 +197,7 @@ class BasicSwap(BaseApp):
|
|||||||
self._updating_wallets_info = {}
|
self._updating_wallets_info = {}
|
||||||
self._last_updated_wallets_info = 0
|
self._last_updated_wallets_info = 0
|
||||||
|
|
||||||
|
|
||||||
# TODO: Adjust ranges
|
# TODO: Adjust ranges
|
||||||
self.min_delay_event = self.settings.get('min_delay_event', 10)
|
self.min_delay_event = self.settings.get('min_delay_event', 10)
|
||||||
self.max_delay_event = self.settings.get('max_delay_event', 60)
|
self.max_delay_event = self.settings.get('max_delay_event', 60)
|
||||||
@ -606,7 +608,7 @@ class BasicSwap(BaseApp):
|
|||||||
raise ValueError('Unable to upgrade database.')
|
raise ValueError('Unable to upgrade database.')
|
||||||
|
|
||||||
def waitForDaemonRPC(self, coin_type):
|
def waitForDaemonRPC(self, coin_type):
|
||||||
for i in range(21):
|
for i in range(self.startup_tries):
|
||||||
if not self.is_running:
|
if not self.is_running:
|
||||||
return
|
return
|
||||||
try:
|
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))
|
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)
|
time.sleep(1 + i)
|
||||||
self.log.error('Can\'t connect to %s RPC, exiting.', coin_type)
|
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):
|
def checkSynced(self, coin_from, coin_to):
|
||||||
check_coins = (coin_from, coin_to)
|
check_coins = (coin_from, coin_to)
|
||||||
|
Loading…
Reference in New Issue
Block a user