From 18e37f3d20e0537aba14439a507af92ed3ee649a Mon Sep 17 00:00:00 2001 From: nailer Date: Sat, 17 Nov 2018 12:58:56 +0200 Subject: [PATCH] sleep time timeout time instead of 5 seconds always --- telebot/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index 52a4e5a..3a93750 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -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")