From 32b7870bf2cc16f57c530a22ea72f52ec43ea711 Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 17 Jul 2024 22:35:21 +0200 Subject: [PATCH] feat: introduce timeouts for outgoing requests --- upub/core/src/traits/fetch.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/upub/core/src/traits/fetch.rs b/upub/core/src/traits/fetch.rs index 293eeb0..54ea2bc 100644 --- a/upub/core/src/traits/fetch.rs +++ b/upub/core/src/traits/fetch.rs @@ -102,6 +102,9 @@ pub trait Fetcher { fn client(domain: &str) -> reqwest::Client { reqwest::Client::builder() .user_agent(format!("upub+{} ({domain})", crate::VERSION)) + .connect_timeout(std::time::Duration::from_secs(30)) // TODO may be cool to configure these + .read_timeout(std::time::Duration::from_secs(30)) // TODO may be cool to configure these + .timeout(std::time::Duration::from_secs(300)) // TODO may be cool to configure these .build() .expect("failed building http client, check system tls or resolver") }