"pict-rs",
"reqwest",
"reqwest-middleware",
- "reqwest-retry",
"reqwest-tracing",
"serde",
"serde_json",
"thiserror",
]
-[[package]]
-name = "reqwest-retry"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e29d842a94e8ab9b581fd3b906053872aef2fb3e474cbd88712047895d2deee4"
-dependencies = [
- "anyhow",
- "async-trait",
- "chrono",
- "futures",
- "http",
- "hyper",
- "reqwest",
- "reqwest-middleware",
- "retry-policies",
- "task-local-extensions",
- "tokio",
- "tracing",
-]
-
[[package]]
name = "reqwest-tracing"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0"
-[[package]]
-name = "retry-policies"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "47f9e19b18c6cdd796cc70aea8a9ea5ee7b813be611c6589e3624fcdbfd05f9d"
-dependencies = [
- "anyhow",
- "chrono",
- "rand 0.8.5",
-]
-
[[package]]
name = "rgb"
version = "0.8.34"
reqwest-tracing = "0.4.0"
clokwerk = "0.3.5"
doku = { version = "0.20.0", features = ["url-2"] }
-reqwest-retry = "0.2.0"
bcrypt = "0.13.0"
chrono = { version = "0.4.22", features = ["serde"], default-features = false }
serde_json = { version = "1.0.87", features = ["preserve_order"] }
reqwest-tracing = { workspace = true }
clokwerk = { workspace = true }
doku = { workspace = true }
-reqwest-retry = { workspace = true }
serde_json = { workspace = true }
futures = { workspace = true }
actix = { workspace = true }
};
use reqwest::Client;
use reqwest_middleware::ClientBuilder;
-use reqwest_retry::{policies::ExponentialBackoff, RetryTransientMiddleware};
use reqwest_tracing::TracingMiddleware;
use std::{env, thread, time::Duration};
use tracing::subscriber::set_global_default;
let reqwest_client = Client::builder()
.user_agent(user_agent.clone())
.timeout(REQWEST_TIMEOUT)
+ .connect_timeout(REQWEST_TIMEOUT)
.build()?;
- let retry_policy = ExponentialBackoff {
- max_n_retries: 3,
- max_retry_interval: REQWEST_TIMEOUT,
- min_retry_interval: Duration::from_millis(100),
- backoff_exponent: 2,
- };
-
let client = ClientBuilder::new(reqwest_client.clone())
.with(TracingMiddleware::default())
- .with(RetryTransientMiddleware::new_with_policy(retry_policy))
.build();
// Pictrs cannot use the retry middleware