# HG changeset patch # User Goffi # Date 1452868957 -3600 # Node ID c1907a460f6a71f510bfac8e3154e5fa3057b4cd # Parent a5b5178ef6b9a58db1b0fea5b98bad7a12226d81 browser (json): changed rules for retry delay when connection with server is lost diff -r a5b5178ef6b9 -r c1907a460f6a src/browser/sat_browser/json.py --- a/src/browser/sat_browser/json.py Fri Jan 15 15:42:37 2016 +0100 +++ b/src/browser/sat_browser/json.py Fri Jan 15 15:42:37 2016 +0100 @@ -30,6 +30,7 @@ from sat_browser import main_panel from sat_browser.constants import Const as C +import random class LiberviaMethodProxy(object): @@ -248,9 +249,14 @@ msg_html = u"Connection with server lost. Retrying in {} s".format(remaining) self.retry_warning.showWarning("WARNING", msg_html, None) - retry_delay = 2**self.retry_nb + if self.retry_nb < 3: + retry_delay = 1 + elif self.retry_nb < 10: + retry_delay = random.randint(1,10) + else: + retry_delay = random.randint(1,60) self.retry_nb += 1 - log.warning(u"Lost connection, trying to reconnect in {} s".format(retry_delay)) + log.warning(u"Lost connection, trying to reconnect in {} s (try #{})".format(retry_delay, self.retry_nb)) self.retry_time = time.time() + retry_delay self.retry_warning = main_panel.WarningPopup() self.retry_timer = Timer(notify=_timerCb)