From b29a9a97db2a83a1ee36ab259b356322a173e3a2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 07:21:45 +0000 Subject: [PATCH 1/3] Update tower requirement from 0.4.13 to 0.5.1 Updates the requirements on [tower](https://github.com/tower-rs/tower) to permit the latest version. - [Release notes](https://github.com/tower-rs/tower/releases) - [Commits](https://github.com/tower-rs/tower/compare/tower-0.4.13...tower-0.5.1) --- updated-dependencies: - dependency-name: tower dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 5ede4350..afce307c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,7 +52,7 @@ serde_path_to_error = "0.1.4" serde_urlencoded = "0.7.1" snafu = "0.8" tokio = { version = "1.17.0", default-features = false, features = ["time"], optional = true } -tower = { version = "0.4.13", default-features = false, features = ["util", "buffer"] } +tower = { version = "0.5.1", default-features = false, features = ["util", "buffer"] } tower-http = { version = "0.6.1", features = ["map-response-body", "trace"] } tracing = { version = "0.1.37", features = ["log"], optional = true } url = { version = "2.2.2", features = ["serde"] } From e60b836417e7667ce786560cf974d2bb7eeb37f2 Mon Sep 17 00:00:00 2001 From: vlad1slav <2307665+vlad1slav@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:01:39 +0300 Subject: [PATCH 2/3] build erros fix, RetryConfig trait and Buffer updates --- src/lib.rs | 5 +++-- src/service/middleware/retry.rs | 16 +++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 6f8220a5..16acc11b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -947,10 +947,11 @@ pub enum AuthState { } pub type OctocrabService = Buffer< - BoxService, http::Response>, BoxError>, - http::Request, + http::Request, + , http::Response>, BoxError> as tower::Service>>::Future >; + /// The GitHub API client. #[derive(Clone)] pub struct Octocrab { diff --git a/src/service/middleware/retry.rs b/src/service/middleware/retry.rs index a0c8ed62..2e38564f 100644 --- a/src/service/middleware/retry.rs +++ b/src/service/middleware/retry.rs @@ -12,12 +12,12 @@ pub enum RetryConfig { } impl Policy, Response, Error> for RetryConfig { - type Future = futures_util::future::Ready; + type Future = futures_util::future::Ready<()>; fn retry( - &self, - _req: &Request, - result: Result<&Response, &Error>, + &mut self, + _req: &mut Request, + result: &mut Result, Error>, ) -> Option { match self { RetryConfig::None => None, @@ -25,7 +25,8 @@ impl Policy, Response, Error> for RetryConfig { Ok(response) => { if response.status().is_server_error() || response.status() == 429 { if *count > 0 { - Some(future::ready(RetryConfig::Simple(count - 1))) + *count -= 1; + Some(future::ready(())) } else { None } @@ -35,7 +36,8 @@ impl Policy, Response, Error> for RetryConfig { } Err(_) => { if *count > 0 { - Some(future::ready(RetryConfig::Simple(count - 1))) + *count -= 1; + Some(future::ready(())) } else { None } @@ -44,7 +46,7 @@ impl Policy, Response, Error> for RetryConfig { } } - fn clone_request(&self, req: &Request) -> Option> { + fn clone_request(&mut self, req: &Request) -> Option> { match self { RetryConfig::None => None, _ => { From a1ac071ed27ed88491cfca5bf4742a9ca1d89a82 Mon Sep 17 00:00:00 2001 From: vlad1slav <2307665+vlad1slav@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:08:03 +0300 Subject: [PATCH 3/3] fix fmt --- src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 16acc11b..f1aae9ac 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -947,11 +947,10 @@ pub enum AuthState { } pub type OctocrabService = Buffer< - http::Request, + http::Request, , http::Response>, BoxError> as tower::Service>>::Future >; - /// The GitHub API client. #[derive(Clone)] pub struct Octocrab {