pyTelegramBotAPI icon indicating copy to clipboard operation
pyTelegramBotAPI copied to clipboard

Multi-threading with webhook

Open RooTooRD opened this issue 1 year ago • 1 comments

Please answer these questions before submitting your issue. Thanks!

  1. What version of pyTelegramBotAPI are you using? 4.15.4
  2. What OS are you using? linux
  3. What version of python are you using? 3.10

The problem:

There is an issue in multi-threading, when you use webhook with multi-threading, the message handler doesn't work and the temporary solution for it is to disable multi-threading with this bot = telebot.TeleBot(API_TOKEN, threaded=False)

RooTooRD avatar Feb 17 '24 12:02 RooTooRD

What frontend are you using for webhooks?

Badiboy avatar Feb 17 '24 12:02 Badiboy

flask

RooTooRD avatar Feb 27 '24 15:02 RooTooRD

flask has parallel engine itself, it's better use flask threading then bot one.

Badiboy avatar Feb 27 '24 16:02 Badiboy

Please provide more code, I can work fine with django

MaGua-Bishop avatar Mar 14 '24 05:03 MaGua-Bishop

https://github.com/eternnoir/pyTelegramBotAPI/issues/2191

The same issue as here. "Threaded" works only with polling mode. For webhooks ithreaded should be "False" and threading / processes should be handled by frontend.

Badiboy avatar Mar 16 '24 09:03 Badiboy