Skip to content

Avoid telegram limit hit#1221

Closed
Hagai wants to merge 4 commits intotqdm:masterfrom
Hagai:avoid-telegram-limit-hit
Closed

Avoid telegram limit hit#1221
Hagai wants to merge 4 commits intotqdm:masterfrom
Hagai:avoid-telegram-limit-hit

Conversation

@Hagai
Copy link
Copy Markdown

@Hagai Hagai commented Aug 3, 2021

Using tqdm.contrib.telegram.tqdm with fast iteration results in "Too Many Requests" Error.

This issue is submitted in #1220.

Avoid sending more than one message per second via telegram bot.
…am, self).__init__(*args, **kwargs) is called because it calls self.display.
@Hagai Hagai requested a review from casperdcl as a code owner August 3, 2021 12:52
@Hagai
Copy link
Copy Markdown
Author

Hagai commented Aug 4, 2021

I was referred to #1076 (comment) and saw I could use mininterval parameter to limit update rate. I've changed this pull request by setting the default mininterval for tqdm_telegram to 1 only for tqdm_telegram according to https://core.telegram.org/bots/faq#my-bot-is-hitting-limits-how-do-i-avoid-this.

Also, I've added a warning which detect "Too Many Requests" error upon TelegramIO initialization (It's critical to detect the error at this stage because it prevents setting the message_id attribute.

I think this pull request will provide more robustness to the telegram integration and better error reporting without any sacrifice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants