Motivations
When creating an ExponentialBackoff policy, I'd like to be able to specify two things:
- That I'll try at most 3 times,
- That I'll try for at most 60 seconds, whether or not I am able to complete 3 retries within the 60 seconds.
Solution
ExponentialBackoffBuilder would have a build_with_max_retries_and_total_duration method
or
ExponentialBackoffTimed::backoff would be public so that I could set ExponentialBackoff::max_n_retries (which is already public)
or
ExponentialBackoffBuilder would have a max_n_retries method that could be used to set it before calling build_with_total_duration.
Alternatives
I had assumed that build_with_total_retry_duration_and_max_retries would already accept a duration and number of retries, until I looked closer and saw that it calculates the number of retries that could fit within the duration. But what I'd like is a way to specify what's described in the doc comment: "...enforce whatever comes first, max retries or total duration."
Motivations
When creating an ExponentialBackoff policy, I'd like to be able to specify two things:
Solution
ExponentialBackoffBuilderwould have abuild_with_max_retries_and_total_durationmethodor
ExponentialBackoffTimed::backoffwould be public so that I could setExponentialBackoff::max_n_retries(which is already public)or
ExponentialBackoffBuilderwould have amax_n_retriesmethod that could be used to set it before callingbuild_with_total_duration.Alternatives
I had assumed that
build_with_total_retry_duration_and_max_retrieswould already accept a duration and number of retries, until I looked closer and saw that it calculates the number of retries that could fit within the duration. But what I'd like is a way to specify what's described in the doc comment: "...enforce whatever comes first, max retries or total duration."