mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Message handler support create_threads flag.
This commit is contained in:
parent
3d678707ac
commit
e095a2ffe9
@ -135,7 +135,6 @@ class TeleBot:
|
|||||||
def __polling(self):
|
def __polling(self):
|
||||||
print('TeleBot: Started polling.')
|
print('TeleBot: Started polling.')
|
||||||
while not self.__stop_polling:
|
while not self.__stop_polling:
|
||||||
print('Get new')
|
|
||||||
try:
|
try:
|
||||||
self.get_update()
|
self.get_update()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -367,9 +366,12 @@ class TeleBot:
|
|||||||
for message in new_messages:
|
for message in new_messages:
|
||||||
for message_handler in self.message_handlers:
|
for message_handler in self.message_handlers:
|
||||||
if self._test_message_handler(message_handler, message):
|
if self._test_message_handler(message_handler, message):
|
||||||
|
if self.create_threads:
|
||||||
self.worker_pool.put(message_handler['function'], message)
|
self.worker_pool.put(message_handler['function'], message)
|
||||||
# t = threading.Thread(target=message_handler['function'], args=(message,))
|
# t = threading.Thread(target=message_handler['function'], args=(message,))
|
||||||
# t.start()
|
# t.start()
|
||||||
|
else:
|
||||||
|
message_handler['function'](message)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user