Skip to content

Commit

Permalink
Bump tower-http to v0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
paolobarbolini committed Aug 13, 2024
1 parent 5a6a4a8 commit 3d5042f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples/axum-key-value-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT"

[dependencies]
tokio = { version = "1.32.0", features = ["full"] }
tower = { version = "0.4.13", features = ["full"] }
tower = { version = "0.5", features = ["full"] }
tower-http = { path = "../../tower-http", features = ["full"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/tonic-key-value-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tokio = { version = "1.2.0", features = ["full"] }
futures = "0.3"
tokio-stream = { version = "0.1", features = ["sync", "net"] }
tonic = "0.9"
tower = { version = "0.4.5", features = ["full"] }
tower = { version = "0.5", features = ["full"] }
tower-http = { path = "../../tower-http", features = ["full"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/warp-key-value-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bytes = "1"
clap = { version = "4.3.16", features = ["derive"] }
hyper = { version = "0.14.4", features = ["full"] }
tokio = { version = "1.2.0", features = ["full"] }
tower = { version = "0.4.5", features = ["full"] }
tower = { version = "0.5", features = ["full"] }
tower-http = { path = "../../tower-http", features = ["full"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
Expand Down
4 changes: 2 additions & 2 deletions tower-http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ mime_guess = { version = "2", optional = true, default_features = false }
percent-encoding = { version = "2.1.0", optional = true }
tokio = { version = "1.6", optional = true, default_features = false }
tokio-util = { version = "0.7", optional = true, default_features = false, features = ["io"] }
tower = { version = "0.4.1", optional = true }
tower = { version = "0.5", optional = true }
tracing = { version = "0.1", default_features = false, optional = true }
httpdate = { version = "1.0", optional = true }
uuid = { version = "1.0", features = ["v4"], optional = true }
Expand All @@ -52,7 +52,7 @@ once_cell = "1"
serde_json = "1.0"
sync_wrapper = "1"
tokio = { version = "1", features = ["full"] }
tower = { version = "0.4.10", features = ["buffer", "util", "retry", "make", "timeout"] }
tower = { version = "0.5", features = ["buffer", "util", "retry", "make", "timeout"] }
tracing-subscriber = "0.3"
uuid = { version = "1.0", features = ["v4"] }
zstd = "0.13"
Expand Down
14 changes: 7 additions & 7 deletions tower-http/src/classify/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,20 +397,20 @@ mod usable_for_retries {
Request<ReqB>: Clone,
E: std::error::Error + 'static,
{
type Future = std::future::Ready<RetryBasedOnClassification<C>>;
type Future = std::future::Ready<()>;

fn retry(
&self,
_req: &Request<ReqB>,
res: Result<&Response<ResB>, &E>,
&mut self,
_req: &mut Request<ReqB>,
res: &mut Result<Response<ResB>, E>,
) -> Option<Self::Future> {
match res {
Ok(res) => {
if let ClassifiedResponse::Ready(class) =
self.classifier.clone().classify_response(res)
{
if class.err()?.is_retryable() {
return Some(std::future::ready(self.clone()));
return Some(std::future::ready(()));
}
}

Expand All @@ -421,11 +421,11 @@ mod usable_for_retries {
.clone()
.classify_error(err)
.is_retryable()
.then(|| std::future::ready(self.clone())),
.then(|| std::future::ready(())),
}
}

fn clone_request(&self, req: &Request<ReqB>) -> Option<Request<ReqB>> {
fn clone_request(&mut self, req: &Request<ReqB>) -> Option<Request<ReqB>> {
Some(req.clone())
}
}
Expand Down

0 comments on commit 3d5042f

Please sign in to comment.