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

Support 'no max delay' and 'no max times' for FibonacciBuilder and ExponentialBuilder #158

Closed
Qqwy opened this issue Nov 2, 2024 · 2 comments

Comments

@Qqwy
Copy link

Qqwy commented Nov 2, 2024

First, thank you for the great library! There are a number of async-supporting retry-libraries in Rust but I really like the user-friendly API of Backon. 🫶

As for my small feature request (and if you want I can contribute a PR for this):

Currently, FibonacciBuilder and ExponentialBuilder support overriding the max delay and max repetitions by using the .with_max_delay and .with_max_times methods.
However, since they by default already have these values set, and since there is on method to turn them off, it is not possible to use them with an indefinite amount of times, or an ever-growing amount of delay.

It is of course currently possible to build our own, by creating our own iterator, but then we're re-implementing FibonacciBackoff/ExponentialBackoff and that is a bit of a waste.

Looking at their sources, it seems like the idea to make these values optional was already considered, since they are Optional<...>.

So I'd like to propose adding .without_max_delay() and .without_max_times() (names are bikesheddable) methods to the two builders.

WDYT?

@nardoor
Copy link
Contributor

nardoor commented Nov 17, 2024

I agree, this is something we need on https://github.com/rustic-rs/rustic to transition from backoff to backon.

@Xuanwo
Copy link
Owner

Xuanwo commented Nov 22, 2024

Implemented in #160

@Xuanwo Xuanwo closed this as completed Nov 22, 2024
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

No branches or pull requests

3 participants