Set global timeout for ureq requests

This commit is contained in:
meehl committed 2026-03-09 16:30:00 +01:00
1 parent 913d2127d8
commit 1f89e31f30
1 file changed
+9 -2
+9 -2
View File
@@ -19,7 +19,7 @@ use std::{
sync::mpsc::{self, Receiver, TryRecvError},
thread,
};
use ureq::http::Response;
use ureq::{Agent, config::Config, http::Response};
const REPO_NAME: &str = "meehl/rusty-pob-manifest";
@@ -486,9 +486,16 @@ fn http_get_with_backoff(url: &str) -> anyhow::Result<Response<ureq::Body>> {
let mut attempt = 0;
let mut backoff_secs: u64 = 2;
let config = Agent::config_builder()
.timeout_global(Some(Duration::from_secs(10)))
.build();
let agent: Agent = config.into();
loop {
attempt += 1;
let resp_result = ureq::get(url)
let resp_result = agent
.get(url)
.header("User-Agent", "rusty-path-of-building")
.call();