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

Example configuring exponential backoff? #47

Open
tobymurray opened this issue Nov 14, 2021 · 1 comment
Open

Example configuring exponential backoff? #47

tobymurray opened this issue Nov 14, 2021 · 1 comment

Comments

@tobymurray
Copy link

tobymurray commented Nov 14, 2021

I want a greater duration between the initial failure and the first retry. The docs show a lot of examples with ExponentialBackoff::default(), what's the recommended way to configure it? Is it sensible to do something like:

let backoff = ExponentialBackoff {
		initial_interval: std::time::Duration::from_secs(1),
		current_interval: std::time::Duration::from_secs(1),
		..Default::default()
	};

Does current_interval need to be set to the same value as initial_interval?

@tobymurray tobymurray changed the title Example configuring exponential default? Example configuring exponential backoff? Nov 14, 2021
@svet-b
Copy link

svet-b commented Oct 19, 2022

Not sure if better or worse, but the following also works:

let backoff = ExponentialBackoffBuilder::new()
    .with_initial_interval(std::time::Duration::from_secs(1))
    .build();

Either way, I agree that it would be best to have the correct (and least likely to break) approach documented.

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

2 participants