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

Bump tower to v0.5 #503

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 3 additions & 1 deletion tower-http/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# Unreleased
# 0.6.0
paolobarbolini marked this conversation as resolved.
Show resolved Hide resolved

## Changed:

- `body` module is disabled except for `catch-panic`, `decompression-*`, `fs`, or `limit` features (BREAKING) ([#477])
- Update to `tower` 0.5 ([#503])

[#477]: https://github.com/tower-rs/tower-http/pull/477
[#503]: https://github.com/tower-rs/tower-http/pull/503

# 0.5.2

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
Loading