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

[enhancement] Add Functional Options for Configuring ExponentialBackOff #136

Closed
KhanSufiyanMirza opened this issue Sep 12, 2023 · 3 comments · Fixed by #137
Closed

[enhancement] Add Functional Options for Configuring ExponentialBackOff #136

KhanSufiyanMirza opened this issue Sep 12, 2023 · 3 comments · Fixed by #137

Comments

@KhanSufiyanMirza
Copy link

KhanSufiyanMirza commented Sep 12, 2023

Description:
As part of enhancing the usability of the backoff library, I propose adding functional options for configuring the ExponentialBackOff struct. Functional options provide a more flexible and extensible way to set various parameters for the ExponentialBackOff.

Feature Details:

  • Add functional options for InitialInterval, RandomizationFactor, Multiplier, MaxInterval, MaxElapsedTime, StopDuration, and Clock.
  • Update NewExponentialBackOff to accept these functional options.

Expected Behavior:
Developers will be able to easily configure the ExponentialBackOff struct with the desired parameters using functional options. This will make the library more user-friendly and customizable.
backOff := NewExponentialBackOff( WithInitialInterval(1*time.Second), WithMultiplier(2.0), WithMaxInterval(10*time.Second), WithMaxElapsedTime(30*time.Second), WithRetryStopDuration(0), WithClockProvider(SystemClock), )

Motivation:
This feature will enhance the library by allowing users to configure the ExponentialBackOff struct in a more intuitive and extensible way. It aligns with best practices for creating flexible APIs.

Additional Information:

  • I have prepared the code changes and unit tests.
  • A pull request is submitted.

Please let me know your thoughts and whether this feature aligns with the project's goals.

@jcass8695
Copy link

@cenkalti could you create a tag for this please?

@rcontreras-te
Copy link

@cenkalti v4.2.1 doesn't have this in it... could we get a next release please? (cc: @KhanSufiyanMirza )

@cenkalti
Copy link
Owner

Tagged as v4.3.0

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

Successfully merging a pull request may close this issue.

4 participants