From e138d2e1ef7a6f1d74ae48e2ff088f7d878eff65 Mon Sep 17 00:00:00 2001 From: Artom-Kozincev Date: Thu, 6 Apr 2017 22:12:17 +0300 Subject: [PATCH] Add more accurate control over threads count --- telebot/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index 3b70be9..8d861d4 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -44,7 +44,7 @@ class TeleBot: getUpdates """ - def __init__(self, token, threaded=True, skip_pending=False): + def __init__(self, token, threaded=True, skip_pending=False, num_threads=2): """ :param token: bot API token :return: Telebot object. @@ -75,7 +75,7 @@ class TeleBot: self.threaded = threaded if self.threaded: - self.worker_pool = util.ThreadPool() + self.worker_pool = util.ThreadPool(num_threads=num_threads) def set_webhook(self, url=None, certificate=None, max_connections=None, allowed_updates=None): return apihelper.set_webhook(self.token, url, certificate, max_connections, allowed_updates)