grammyjs / auto-retry

A transformer function for retrying requests.
https://grammy.dev/plugins/auto-retry
MIT License
7 stars 1 forks source link

feat: Add retry strategies #5

Closed KnorpelSenf closed 7 months ago

KnorpelSenf commented 2 years ago

It would be cool to have the choice between different retry strategies, such as linear, quadratic, or exponential, all with configurable parameters.

The grammY runner can already do this while requesting updates, so maybe we can take inspiration from the implementation there.

roziscoding commented 2 years ago

For reference: grammY runner

KnorpelSenf commented 2 years ago

grammY runner implementation of backoff strategies: https://github.com/grammyjs/runner/blob/e883b7ad918ccd13c582e962ddf08829d2647af2/src/runner.ts#L176

KnorpelSenf commented 7 months ago

We not use the same strategy as the Bot API server employs for webhook requests. This is a sane default, and it does not seem like there is a need for additional configuration.

Note that the most common use case is to respect retry_after values anyway, and they have fixed values rather than dynamic backoff. This decreases the usefulness of this feature further.

Closing.