From 57b2f234c1cf36aae245699d0cf13a18606cc1d8 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sun, 18 Sep 2016 15:15:10 +0200 Subject: [PATCH] Limit time to reconnect to 5 minutes. Fixes #8393 --- src/common/connection.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/common/connection.py b/src/common/connection.py index 1e5220ea3..39f65d95d 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -932,13 +932,12 @@ class Connection(CommonConnection, ConnectionHandlers): gajim.status_before_autoaway[self.name] = '' self.old_show = 'online' # this check has moved from _reconnect method - # do exponential backoff until 15 minutes, - # then small linear increase + # do exponential backoff until less than 5 minutes if self.retrycount < 2 or self.last_time_to_reconnect is None: self.last_time_to_reconnect = 5 - if self.last_time_to_reconnect < 800: + self.last_time_to_reconnect += randomsource.randint(0, 5) + if self.last_time_to_reconnect < 200: self.last_time_to_reconnect *= 1.5 - self.last_time_to_reconnect += randomsource.randint(0, 5) self.time_to_reconnect = int(self.last_time_to_reconnect) log.info("Reconnect to %s in %ss", self.name, self.time_to_reconnect) gajim.idlequeue.set_alarm(self._reconnect_alarm,