1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

sleep time timeout time instead of 5 seconds always

This commit is contained in:
nailer 2018-11-17 12:58:56 +02:00
parent a946b79839
commit 18e37f3d20

View File

@ -364,12 +364,12 @@ class TeleBot:
for listener in self.update_listener:
self._exec_task(listener, new_messages)
def infinity_polling(self, *args, **kwargs):
def infinity_polling(self, timeout: int = 20, *args, **kwargs):
while not self.__stop_polling.is_set():
try:
self.polling(*args, **kwargs)
self.polling(timeout=timeout, *args, **kwargs)
except Exception as e:
time.sleep(5)
time.sleep(timeout)
pass
logger.info("Break infinity polling")