Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Allow Operation function to return minimum interval to wait in backoff #134

Open
ItalyPaleAle opened this issue Jun 13, 2023 · 0 comments
Open

Comments

@ItalyPaleAle
Copy link
Contributor

Example: the function invoked by backoff makes HTTP requests, and the server responds with a 429 ("retry after") status code.

We want the Operation function to be able to return an error which indicates that the next backoff should not happen before the given delay.

For example, assume that the next backoff is in 1s, but the server responds with a "Retry-After" indicating a 5s delay. The handler should return a special kind of error (for example, MinBackoffError, similar to PermanentError) that indicates that the next attempt should not happen in less than 5s.

The backoff library will then pick the maximum of the 2 (1s and 5s) and use that as the next backoff.

I am happy to submit a PR if you think you would be interested in this!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant