feat: introduce timeouts for outgoing requests

This commit is contained in:
əlemi 2024-07-17 22:35:21 +02:00
parent 6a6a340618
commit 32b7870bf2
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -102,6 +102,9 @@ pub trait Fetcher {
fn client(domain: &str) -> reqwest::Client { fn client(domain: &str) -> reqwest::Client {
reqwest::Client::builder() reqwest::Client::builder()
.user_agent(format!("upub+{} ({domain})", crate::VERSION)) .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() .build()
.expect("failed building http client, check system tls or resolver") .expect("failed building http client, check system tls or resolver")
} }