feat: use error information to calculate backoff #15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I like the implementation concept of go-retry, but it doesn't support backoff calculation based on the response. My use case: Calculate the backoff delay based on different HTTP responses. For example a 427 HTTP response would take the "Retry-After" header into consideration while a 5XX response would do something different.
Essentially I changed the
Backoff
interface as such:This way the backoff calculation can work on error information (e.g. HTTP response information) and modify the (retry-)error if necessary.
There are some other changes mixed in this PR. I just thought I would show you, maybe you are interested into integrating stuff like this (I know it is quite a lot os changes...).