From b9bedef73f05165202b4124a1c6e30f90ea1deaf Mon Sep 17 00:00:00 2001 From: Artem Lavrenov Date: Sat, 28 Jan 2023 12:26:25 +0300 Subject: [PATCH] Avoid raise RuntimeError(cannot join current thread) --- telebot/util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/telebot/util.py b/telebot/util.py index 3e76f19..4fa81a3 100644 --- a/telebot/util.py +++ b/telebot/util.py @@ -154,7 +154,8 @@ class ThreadPool: for worker in self.workers: worker.stop() for worker in self.workers: - worker.join() + if worker != threading.current_thread(): + worker.join() class AsyncTask: