mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
Dont retry outgoing HTTP requests (ref #2865)
This commit is contained in:
parent
be1f3b1db5
commit
28ebbf903a
53
Cargo.lock
generated
53
Cargo.lock
generated
@ -2274,9 +2274,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2634,7 +2631,6 @@ dependencies = [
|
||||
"rand 0.8.5",
|
||||
"reqwest",
|
||||
"reqwest-middleware",
|
||||
"reqwest-retry",
|
||||
"reqwest-tracing",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@ -4069,29 +4065,6 @@ dependencies = [
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reqwest-retry"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48d0fd6ef4c6d23790399fe15efc8d12cd9f3d4133958f9bd7801ee5cbaec6c4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"chrono",
|
||||
"futures",
|
||||
"getrandom 0.2.9",
|
||||
"http",
|
||||
"hyper",
|
||||
"parking_lot 0.11.2",
|
||||
"reqwest",
|
||||
"reqwest-middleware",
|
||||
"retry-policies",
|
||||
"task-local-extensions",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"wasm-timer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reqwest-tracing"
|
||||
version = "0.4.1"
|
||||
@ -4114,17 +4087,6 @@ version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0"
|
||||
|
||||
[[package]]
|
||||
name = "retry-policies"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e09bbcb5003282bcb688f0bae741b278e9c7e8f378f561522c9806c58e075d9b"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
"rand 0.8.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rgb"
|
||||
version = "0.8.36"
|
||||
@ -5589,21 +5551,6 @@ dependencies = [
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-timer"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"js-sys",
|
||||
"parking_lot 0.11.2",
|
||||
"pin-utils",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.61"
|
||||
|
@ -77,7 +77,6 @@ reqwest-tracing = "0.4.0"
|
||||
clokwerk = "0.3.5"
|
||||
doku = { version = "0.20.0", features = ["url-2"] }
|
||||
parking_lot = "0.12.1"
|
||||
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"] }
|
||||
@ -133,7 +132,6 @@ reqwest-tracing = { workspace = true }
|
||||
clokwerk = { workspace = true }
|
||||
doku = { workspace = true }
|
||||
parking_lot = { workspace = true }
|
||||
reqwest-retry = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
actix = { workspace = true }
|
||||
|
10
src/lib.rs
10
src/lib.rs
@ -32,7 +32,6 @@ use lemmy_utils::{
|
||||
};
|
||||
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;
|
||||
@ -107,18 +106,11 @@ pub async fn start_lemmy_server() -> Result<(), LemmyError> {
|
||||
let reqwest_client = Client::builder()
|
||||
.user_agent(build_user_agent(&settings))
|
||||
.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
|
||||
|
Loading…
Reference in New Issue
Block a user