Allow Operation function to return minimum interval to wait in backoff
ItalyPaleAle opened this issue · 0 comments
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!