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

Unlimited retries possible in implementation, but not trough public API #48

Open
NyCodeGHG opened this issue Feb 26, 2023 · 3 comments
Open

Comments

@NyCodeGHG
Copy link

If I'm seeing this correctly, it should be possible to have unlimited retries in the implementation, but there seems no way of doing that via the public API, because the Default implementation defaults to 3 retries?

Is that intended or did I miss anything?

@Xuanwo
Copy link
Owner

Xuanwo commented Feb 28, 2023

Yes, we have not presented a direct method for that. Might you have a requirement for this?

We can use with_max_times to workaround it:

let builder = ConstantBuilder::default().with_max_times(usize::MAX);

@NyCodeGHG
Copy link
Author

NyCodeGHG commented Feb 28, 2023

thats what i'm using right now, but feels a bit hacky, also that could theoretically overflow.

Maybe a new function like ConstantBuilder::unlimited would be better for this?

@Xuanwo
Copy link
Owner

Xuanwo commented Feb 28, 2023

Maybe a new function like ConstantBuilder::unlimited would be better for this?

Seems not a good idea to me. I plan to add a FnBuilder that accept a function which will return the next delay like the following:

let f = FnBuilder::new(|| Some(Durtion::from_secs(1)));

What do you think?

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