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

RetryDecision is not exposed from reqwest_retry #84

Closed
emilbonnek opened this issue Mar 28, 2023 · 2 comments · Fixed by #157
Closed

RetryDecision is not exposed from reqwest_retry #84

emilbonnek opened this issue Mar 28, 2023 · 2 comments · Fixed by #157
Labels
bug Something isn't working

Comments

@emilbonnek
Copy link

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.

@emilbonnek emilbonnek added the bug Something isn't working label Mar 28, 2023
@tl-rodrigo-gryzinski
Copy link
Contributor

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.

@emilbonnek
Copy link
Author

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.

cbeck88 added a commit to cbeck88/reqwest-middleware that referenced this issue May 31, 2024
eopb pushed a commit that referenced this issue Jun 1, 2024
@eopb eopb closed this as completed in #157 Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants