Open LucioFranco opened 2 years ago
It would be cool if this could integrate with 429/Retry-After
header out-of-the-box.
@lovesegfault yeah, good idea, this seems like a config option that could live in HttpRetry
.
+1 to lovesegfault, I found this crate will looking for a way to handle Retry-After easily
so this issue delay ?
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
(https://github.com/tower-rs/tower/pull/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 https://github.com/tower-rs/tower/pull/686Budget
trait to allow users to choose which implementation to use.StandardRetryPolicy
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