Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle 429 response codes when running message recycling #4

Open
armand1m opened this issue Jun 12, 2021 · 0 comments
Open

Handle 429 response codes when running message recycling #4

armand1m opened this issue Jun 12, 2021 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@armand1m
Copy link
Owner

Describe the bug

When there are too many messages to be deleted, the server triggers too many calls at once to Telegram API and reaches the rate limit, which then makes it start to reply with the following:

(node:1) UnhandledPromiseRejectionWarning: Error: 429: Too Many Requests: retry after 6
    at Telegram.callApi (/app/node_modules/telegraf/lib/core/network/client.js:258:19)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

To Reproduce
Steps to reproduce the behaviour:

  1. Get the bot running and added into a channel
  2. Trigger multiple messages that are candidates for message recycling very quickly
  3. Wait until the next message recycling cycle
  4. See errors

Expected behaviour
The message recycling logic should consider that the rate limits might be reached and should defer message deletion according to the suggestions given by the Telegram API (e.g.: retry in 6 as told by the example)

@armand1m armand1m added bug Something isn't working help wanted Extra attention is needed labels Jun 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant