[EWT-319] Upgrade retry-policies (#104)

This commit is contained in:
Thom Wright 2023-09-08 10:22:46 +01:00 committed by GitHub
parent f1e71bef3c
commit 7eb52bbe65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 33 deletions

View file

@ -4,6 +4,10 @@ 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/), 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.3.0] - 2023-09-07
### Changed
- `retry-policies` upgraded to 0.2.0
## [0.2.3] - 2023-08-30 ## [0.2.3] - 2023-08-30
### Added ### Added
- `RetryableStrategy` which allows for custom retry decisions based on the response that a request got - `RetryableStrategy` which allows for custom retry decisions based on the response that a request got

View file

@ -1,6 +1,6 @@
[package] [package]
name = "reqwest-retry" name = "reqwest-retry"
version = "0.2.3" version = "0.3.0"
authors = ["Rodrigo Gryzinski <rodrigo.gryzinski@truelayer.com>"] authors = ["Rodrigo Gryzinski <rodrigo.gryzinski@truelayer.com>"]
edition = "2018" edition = "2018"
description = "Retry middleware for reqwest." description = "Retry middleware for reqwest."
@ -18,7 +18,7 @@ chrono = { version = "0.4.19", features = ["clock"], default-features = false }
futures = "0.3.0" futures = "0.3.0"
http = "0.2.0" http = "0.2.0"
reqwest = { version = "0.11.0", default-features = false } reqwest = { version = "0.11.0", default-features = false }
retry-policies = "0.1.0" retry-policies = "0.2.0"
task-local-extensions = "0.1.4" task-local-extensions = "0.1.4"
tracing = "0.1.26" tracing = "0.1.26"

View file

@ -53,12 +53,12 @@ macro_rules! assert_retry_succeeds_inner {
let reqwest_client = Client::builder().build().unwrap(); let reqwest_client = Client::builder().build().unwrap();
let client = ClientBuilder::new(reqwest_client) let client = ClientBuilder::new(reqwest_client)
.with(RetryTransientMiddleware::new_with_policy( .with(RetryTransientMiddleware::new_with_policy(
ExponentialBackoff { ExponentialBackoff::builder()
max_n_retries: retry_amount, .retry_bounds(
max_retry_interval: std::time::Duration::from_millis(30), std::time::Duration::from_millis(30),
min_retry_interval: std::time::Duration::from_millis(100), std::time::Duration::from_millis(100),
backoff_exponent: 2, )
}, .build_with_max_retries(retry_amount),
)) ))
.build(); .build();
@ -189,12 +189,12 @@ async fn assert_retry_on_request_timeout() {
let reqwest_client = Client::builder().build().unwrap(); let reqwest_client = Client::builder().build().unwrap();
let client = ClientBuilder::new(reqwest_client) let client = ClientBuilder::new(reqwest_client)
.with(RetryTransientMiddleware::new_with_policy( .with(RetryTransientMiddleware::new_with_policy(
ExponentialBackoff { ExponentialBackoff::builder()
max_n_retries: 3, .retry_bounds(
max_retry_interval: std::time::Duration::from_millis(100), std::time::Duration::from_millis(30),
min_retry_interval: std::time::Duration::from_millis(30), std::time::Duration::from_millis(100),
backoff_exponent: 2, )
}, .build_with_max_retries(3),
)) ))
.build(); .build();
@ -244,12 +244,12 @@ async fn assert_retry_on_incomplete_message() {
let reqwest_client = Client::builder().build().unwrap(); let reqwest_client = Client::builder().build().unwrap();
let client = ClientBuilder::new(reqwest_client) let client = ClientBuilder::new(reqwest_client)
.with(RetryTransientMiddleware::new_with_policy( .with(RetryTransientMiddleware::new_with_policy(
ExponentialBackoff { ExponentialBackoff::builder()
max_n_retries: 3, .retry_bounds(
max_retry_interval: std::time::Duration::from_millis(100), std::time::Duration::from_millis(30),
min_retry_interval: std::time::Duration::from_millis(30), std::time::Duration::from_millis(100),
backoff_exponent: 2, )
}, .build_with_max_retries(3),
)) ))
.build(); .build();
@ -295,12 +295,12 @@ async fn assert_retry_on_hyper_canceled() {
let reqwest_client = Client::builder().build().unwrap(); let reqwest_client = Client::builder().build().unwrap();
let client = ClientBuilder::new(reqwest_client) let client = ClientBuilder::new(reqwest_client)
.with(RetryTransientMiddleware::new_with_policy( .with(RetryTransientMiddleware::new_with_policy(
ExponentialBackoff { ExponentialBackoff::builder()
max_n_retries: 3, .retry_bounds(
max_retry_interval: std::time::Duration::from_millis(100), std::time::Duration::from_millis(30),
min_retry_interval: std::time::Duration::from_millis(30), std::time::Duration::from_millis(100),
backoff_exponent: 2, )
}, .build_with_max_retries(3),
)) ))
.build(); .build();
@ -343,12 +343,12 @@ async fn assert_retry_on_connection_reset_by_peer() {
let reqwest_client = Client::builder().build().unwrap(); let reqwest_client = Client::builder().build().unwrap();
let client = ClientBuilder::new(reqwest_client) let client = ClientBuilder::new(reqwest_client)
.with(RetryTransientMiddleware::new_with_policy( .with(RetryTransientMiddleware::new_with_policy(
ExponentialBackoff { ExponentialBackoff::builder()
max_n_retries: 3, .retry_bounds(
max_retry_interval: std::time::Duration::from_millis(100), std::time::Duration::from_millis(30),
min_retry_interval: std::time::Duration::from_millis(30), std::time::Duration::from_millis(100),
backoff_exponent: 2, )
}, .build_with_max_retries(3),
)) ))
.build(); .build();