Infinity polling fall down fixed

This commit is contained in:
Badiboy
2021-01-14 03:44:37 +03:00
parent 87574a7613
commit 82838e1d26
4 changed files with 10 additions and 6 deletions

View File

@@ -6,6 +6,7 @@ import re
import sys
import threading
import time
import traceback
logger = logging.getLogger('TeleBot')
formatter = logging.Formatter(
@@ -459,7 +460,8 @@ class TeleBot:
try:
self.polling(none_stop=True, timeout=timeout, long_polling_timeout=long_polling_timeout, *args, **kwargs)
except Exception as e:
logger.error("Infinity polling exception: {}".format(e))
logger.error("Infinity polling exception: %s", str(e))
logger.debug("Exception traceback:\n%s", traceback.format_exc())
time.sleep(3)
continue
logger.info("Infinity polling: polling exited")