Async Telebot retries immediately when it runs into a bad gateway error, potentially flooding the API
I'm using pyTelegramBotAPI version 4.20 on Ubuntu Noble (24.04 LTS) with Python 3.12. When async Telebot receives a bad gateway response from Telegram, it will retry immediately and log an unhandled exception. My own code logs the bad gateway error and then sleeps for 5 seconds. During this sleep, several more error messages per second about this unhandled exception will continue to be logged by async Telebot if the server's connection remains unstable, meaning Telebot itself is trying to reconnect over and over and over again for polling without waiting first. This not only floods the API, but it also generates massive log files full of complete garbage and spams the logging output.
https://github.com/eternnoir/pyTelegramBotAPI/assets/116322192/2c67ae1c-7724-4a34-866f-109b12425379