mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
WorkerThreads now log ApiExceptions
This commit is contained in:
parent
941b8ac5d0
commit
60ca1751ca
@ -9,6 +9,9 @@ try:
|
||||
except ImportError:
|
||||
import queue as Queue
|
||||
|
||||
from apihelper import ApiException
|
||||
from telebot import logger
|
||||
|
||||
|
||||
class ThreadPool:
|
||||
class WorkerThread(threading.Thread):
|
||||
@ -30,6 +33,8 @@ class ThreadPool:
|
||||
task(*args, **kwargs)
|
||||
except Queue.Empty:
|
||||
pass
|
||||
except ApiException as e:
|
||||
logger.exception(e)
|
||||
|
||||
def stop(self):
|
||||
self._running = False
|
||||
@ -49,6 +54,7 @@ class ThreadPool:
|
||||
for worker in self.workers:
|
||||
worker.join()
|
||||
|
||||
|
||||
class AsyncTask:
|
||||
def __init__(self, target, *args, **kwargs):
|
||||
self.target = target
|
||||
|
Loading…
Reference in New Issue
Block a user