Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting both total duration and max retries #23

Open
agasparovic opened this issue Jun 23, 2024 · 0 comments
Open

Allow setting both total duration and max retries #23

agasparovic opened this issue Jun 23, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@agasparovic
Copy link

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."

@agasparovic agasparovic added the enhancement New feature or request label Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant