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:
parent
a946b79839
commit
18e37f3d20
@ -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")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user