yagop / node-telegram-bot-api

Telegram Bot API for NodeJS
MIT License
8.12k stars 1.49k forks source link

Bot occasionally doesn't receive update #1197

Open antemikulic98 opened 1 month ago

antemikulic98 commented 1 month ago

I have read:

Usage information Help information

Version: 0.64.0

Expected Behavior The bot always receives data upon the user interacting with the bot

Actual Behavior In some cases, the bot doesn't receive an update after the user interacts with the bot, which results in a "hanging" state.

We have built a TG bot that receives multiple types of messages, and everything works perfectly most of the time. But in some scenarios, when the user clicks on a button, nothing happens for some time, e.g. 30 seconds, and then everything continues as normal.

We have optimized bot in every possible way, added logging temporarily on each step, resolved all errors, we are handling polling_error event, etc.

This issue mostly, if not exclusively happens on Android.

We have checked rate limiting (30 requests per second, 20 requests per chat per minute), and it didn't turn out to be an issue, since bot is still in testing phase.

We have also added console.log to processUpdate directly inside node-telegram-bot-api package, which effectively logs every update we receive from telegram API, and everything seems fine until freeze.

When this freeze happens, we don't receive any update to processUpdate function (which executes every 300ms by default according to package).

We are suspecting that Telegram API itself has occasional hiccups, or that Android version of Telegram has some buggy behaviour, because we removed any blocking operations in our Node.js app. Also, issue is not reproducible, it happens randomly.

Does anyone have some experience with Telegram Bot occasionally freezing, unrelated to current flow?

This bug is driving us nuts for some time now, any help is highly appreciated!