-
Notifications
You must be signed in to change notification settings - Fork 271
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
Retry middleware improvements #682
Labels
A-retry
Area: The tower "retry" middleware
C-enhancement
Category: A PR with an enhancement or a proposed on in an issue.
E-help-wanted
Call for participation: Help is requested to fix this issue.
E-medium
Call for participation: Experience needed to fix: Medium / intermediate
P-high
High priority
Comments
It would be cool if this could integrate with 429/ |
@lovesegfault yeah, good idea, this seems like a config option that could live in |
+1 to lovesegfault, I found this crate will looking for a way to handle Retry-After easily |
LucioFranco
added a commit
that referenced
this issue
Oct 7, 2022
This PR adds a new `standard_policy` module within the retry module that provides a batteries included policy to be used with the retry middleware. The policy combines the `Budget` type and generic backoff utlities from the `backoff` module to provide an easy to use policy with good defaults. This PR also includes a `StandardRetryPolicyBuilder` as well as two new traits `IsRetryable` and `CloneRequest`. These each have blanket impls for closures. The reason that this implementation breaks these out into two different traits is to allow `tower-http` to provide a custom `CloneRequest` implementation that will be able to clone some sort of `ReplayBody` and let the user pass in the retry decision implementation. Ref #682
so this issue delay ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-retry
Area: The tower "retry" middleware
C-enhancement
Category: A PR with an enhancement or a proposed on in an issue.
E-help-wanted
Call for participation: Help is requested to fix this issue.
E-medium
Call for participation: Experience needed to fix: Medium / intermediate
P-high
High priority
This issue scopes out the changes we are proposing to the retry middleware to improve its ergonomics. Currently, the retry middleware is quite hard to use and requires implementing a custom
Policy
. Writing this policy is non-trivial and is more work than it should be.These improvements are aimed at setting up retries with tower to be easier and more user friendly. As well as providing good defaults that work out of the box.
List of improvements to
tower
andtower-http
:Policy
(retry: ChangePolicy
to accept&mut self
#681).&mut self
.Future
output to()
.Policy
to be object safe.trait Backoff
that has an associated future type that allows others to use this utility without being tied totokio::time
.ExponentialBackoff
type that implementsBackoff
, ported fromlinkerd2-proxy
.Rng
utilities util: Addrng
utilities #686retry budget
#613).Budget
trait to allow users to choose which implementation to use.StandardRetryPolicy
andstandard_policy
mod #698StandardRetryPolicy
combiningimpl Backoff
andimpl Budget
.StandardRetryPolicyBuilder
that accept closures (?) foris_retryable(&mut Req, &mut Result<Res, E>) -> bool
and aclone_request(&Req) -> Option<Req>
.tower-http
improvements.retry
moduleReplayBody
similar to the one implemented inlinkerd2-proxy
.HttpRetry
layer that accepts higher level constructs for retrying, likeClassifyResponse
, and will wrap http request bodies withReplayBody
.tower
andtower-http
.tower
andtower-http
.Example code
tower
examples with nohttp
:tower-http
examples:cc @rcoh @hawkw @jonhoo @seanmonstar @davidpdrsn
The text was updated successfully, but these errors were encountered: