mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-01-18 15:20:42 +01:00
Catch URLError while getting updates
This commit is contained in:
parent
56ab40d94f
commit
89ecb04a85
1 changed files with 7 additions and 0 deletions
|
@ -21,6 +21,11 @@ try:
|
|||
except ImportError:
|
||||
from queue import Queue
|
||||
|
||||
try:
|
||||
from urllib2 import URLError
|
||||
except ImportError:
|
||||
from urllib.error import URLError
|
||||
|
||||
H = NullHandler()
|
||||
logging.getLogger(__name__).addHandler(H)
|
||||
|
||||
|
@ -167,6 +172,8 @@ class Updater:
|
|||
self.update_queue.put(te)
|
||||
sleep(current_interval)
|
||||
|
||||
except URLError as e:
|
||||
self.logger.error("Error while getting Updates: %s" % e)
|
||||
# increase waiting times on subsequent errors up to 30secs
|
||||
if current_interval < 30:
|
||||
current_interval += current_interval / 2
|
||||
|
|
Loading…
Reference in a new issue