Skip to content

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

@Qqwy

Description

@Qqwy

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions