From 9dc767b88ea29f702dfc2c0940bf69f9bb4b1ebd Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 12 Apr 2018 10:40:17 +0200 Subject: [PATCH] Wait a little bit before retrying --- pyrogram/session/session.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py index 42b72371..2bd59908 100644 --- a/pyrogram/session/session.py +++ b/pyrogram/session/session.py @@ -19,6 +19,7 @@ import logging import platform import threading +import time from datetime import timedelta, datetime from hashlib import sha1, sha256 from io import BytesIO @@ -314,7 +315,7 @@ class Session: self._send(functions.PingDelayDisconnect( 0, self.WAIT_TIMEOUT + 10 ), False) - except (OSError, TimeoutError): + except (OSError, TimeoutError, Error): pass log.debug("PingThread stopped") @@ -408,6 +409,7 @@ class Session: (log.warning if i > 2 else log.info)( "{}: {} Retrying {}".format(i, datetime.now(), type(data)) ) + time.sleep(1) continue else: return None