mirror of
https://github.com/TrueLayer/reqwest-middleware.git
synced 2024-12-26 19:06:31 +00:00
[EWT-319] Upgrade retry-policies (#104)
This commit is contained in:
parent
f1e71bef3c
commit
7eb52bbe65
3 changed files with 37 additions and 33 deletions
|
@ -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/),
|
||||
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
|
||||
### Added
|
||||
- `RetryableStrategy` which allows for custom retry decisions based on the response that a request got
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "reqwest-retry"
|
||||
version = "0.2.3"
|
||||
version = "0.3.0"
|
||||
authors = ["Rodrigo Gryzinski <rodrigo.gryzinski@truelayer.com>"]
|
||||
edition = "2018"
|
||||
description = "Retry middleware for reqwest."
|
||||
|
@ -18,7 +18,7 @@ chrono = { version = "0.4.19", features = ["clock"], default-features = false }
|
|||
futures = "0.3.0"
|
||||
http = "0.2.0"
|
||||
reqwest = { version = "0.11.0", default-features = false }
|
||||
retry-policies = "0.1.0"
|
||||
retry-policies = "0.2.0"
|
||||
task-local-extensions = "0.1.4"
|
||||
tracing = "0.1.26"
|
||||
|
||||
|
|
|
@ -53,12 +53,12 @@ macro_rules! assert_retry_succeeds_inner {
|
|||
let reqwest_client = Client::builder().build().unwrap();
|
||||
let client = ClientBuilder::new(reqwest_client)
|
||||
.with(RetryTransientMiddleware::new_with_policy(
|
||||
ExponentialBackoff {
|
||||
max_n_retries: retry_amount,
|
||||
max_retry_interval: std::time::Duration::from_millis(30),
|
||||
min_retry_interval: std::time::Duration::from_millis(100),
|
||||
backoff_exponent: 2,
|
||||
},
|
||||
ExponentialBackoff::builder()
|
||||
.retry_bounds(
|
||||
std::time::Duration::from_millis(30),
|
||||
std::time::Duration::from_millis(100),
|
||||
)
|
||||
.build_with_max_retries(retry_amount),
|
||||
))
|
||||
.build();
|
||||
|
||||
|
@ -189,12 +189,12 @@ async fn assert_retry_on_request_timeout() {
|
|||
let reqwest_client = Client::builder().build().unwrap();
|
||||
let client = ClientBuilder::new(reqwest_client)
|
||||
.with(RetryTransientMiddleware::new_with_policy(
|
||||
ExponentialBackoff {
|
||||
max_n_retries: 3,
|
||||
max_retry_interval: std::time::Duration::from_millis(100),
|
||||
min_retry_interval: std::time::Duration::from_millis(30),
|
||||
backoff_exponent: 2,
|
||||
},
|
||||
ExponentialBackoff::builder()
|
||||
.retry_bounds(
|
||||
std::time::Duration::from_millis(30),
|
||||
std::time::Duration::from_millis(100),
|
||||
)
|
||||
.build_with_max_retries(3),
|
||||
))
|
||||
.build();
|
||||
|
||||
|
@ -244,12 +244,12 @@ async fn assert_retry_on_incomplete_message() {
|
|||
let reqwest_client = Client::builder().build().unwrap();
|
||||
let client = ClientBuilder::new(reqwest_client)
|
||||
.with(RetryTransientMiddleware::new_with_policy(
|
||||
ExponentialBackoff {
|
||||
max_n_retries: 3,
|
||||
max_retry_interval: std::time::Duration::from_millis(100),
|
||||
min_retry_interval: std::time::Duration::from_millis(30),
|
||||
backoff_exponent: 2,
|
||||
},
|
||||
ExponentialBackoff::builder()
|
||||
.retry_bounds(
|
||||
std::time::Duration::from_millis(30),
|
||||
std::time::Duration::from_millis(100),
|
||||
)
|
||||
.build_with_max_retries(3),
|
||||
))
|
||||
.build();
|
||||
|
||||
|
@ -295,12 +295,12 @@ async fn assert_retry_on_hyper_canceled() {
|
|||
let reqwest_client = Client::builder().build().unwrap();
|
||||
let client = ClientBuilder::new(reqwest_client)
|
||||
.with(RetryTransientMiddleware::new_with_policy(
|
||||
ExponentialBackoff {
|
||||
max_n_retries: 3,
|
||||
max_retry_interval: std::time::Duration::from_millis(100),
|
||||
min_retry_interval: std::time::Duration::from_millis(30),
|
||||
backoff_exponent: 2,
|
||||
},
|
||||
ExponentialBackoff::builder()
|
||||
.retry_bounds(
|
||||
std::time::Duration::from_millis(30),
|
||||
std::time::Duration::from_millis(100),
|
||||
)
|
||||
.build_with_max_retries(3),
|
||||
))
|
||||
.build();
|
||||
|
||||
|
@ -343,12 +343,12 @@ async fn assert_retry_on_connection_reset_by_peer() {
|
|||
let reqwest_client = Client::builder().build().unwrap();
|
||||
let client = ClientBuilder::new(reqwest_client)
|
||||
.with(RetryTransientMiddleware::new_with_policy(
|
||||
ExponentialBackoff {
|
||||
max_n_retries: 3,
|
||||
max_retry_interval: std::time::Duration::from_millis(100),
|
||||
min_retry_interval: std::time::Duration::from_millis(30),
|
||||
backoff_exponent: 2,
|
||||
},
|
||||
ExponentialBackoff::builder()
|
||||
.retry_bounds(
|
||||
std::time::Duration::from_millis(30),
|
||||
std::time::Duration::from_millis(100),
|
||||
)
|
||||
.build_with_max_retries(3),
|
||||
))
|
||||
.build();
|
||||
|
||||
|
|
Loading…
Reference in a new issue