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:
|
except ImportError:
|
||||||
import queue as Queue
|
import queue as Queue
|
||||||
|
|
||||||
|
from apihelper import ApiException
|
||||||
|
from telebot import logger
|
||||||
|
|
||||||
|
|
||||||
class ThreadPool:
|
class ThreadPool:
|
||||||
class WorkerThread(threading.Thread):
|
class WorkerThread(threading.Thread):
|
||||||
@ -30,6 +33,8 @@ class ThreadPool:
|
|||||||
task(*args, **kwargs)
|
task(*args, **kwargs)
|
||||||
except Queue.Empty:
|
except Queue.Empty:
|
||||||
pass
|
pass
|
||||||
|
except ApiException as e:
|
||||||
|
logger.exception(e)
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self._running = False
|
self._running = False
|
||||||
@ -49,6 +54,7 @@ class ThreadPool:
|
|||||||
for worker in self.workers:
|
for worker in self.workers:
|
||||||
worker.join()
|
worker.join()
|
||||||
|
|
||||||
|
|
||||||
class AsyncTask:
|
class AsyncTask:
|
||||||
def __init__(self, target, *args, **kwargs):
|
def __init__(self, target, *args, **kwargs):
|
||||||
self.target = target
|
self.target = target
|
||||||
|
Loading…
x
Reference in New Issue
Block a user