reqwest-middleware
reqwest-middleware copied to clipboard
RetryDecision is not exposed from reqwest_retry
Bug description
Currently, it is not possible to create custom RetryPolicy
implementations because the RetryDecision
type is not exposed by the crate. So its a bit all or nothing and I can't create a policy that conditionally retry requests.
To Reproduce
This code will not work because the compiler complains about reqwest_retry::RetryDecision
not exisiting.
impl reqwest_retry::RetryPolicy for CustomRetryPolicy {
fn should_retry(&self, attempt: u32) -> reqwest_retry::RetryDecision {
// Some custom logic determining if the request should be retried.
}
}
Expected behavior
I expected the above to work.
Environment
- OS: Windows
- Rust version: 1.67.1
Additional context
I am new to Rust, so please let me know if I am misunderstanding something or if I am using the crate incorrectly.
Oh, you're right. For now you can work around this, the trait is re-exported from retry-policies, so you can add that to your deps and import it from there instead.
We should re-export RetryDecision
as well though, I see no reason not to.
Thanks, I am okay with just using it from retry-policies. I didn't even know that was an option until now.
I'll leave this open in case you want to close it with a PR.