diff --git a/src/cli/version.rs b/src/cli/version.rs index b2946d7f5c..e4a2eff928 100644 --- a/src/cli/version.rs +++ b/src/cli/version.rs @@ -168,7 +168,7 @@ async fn get_latest_version_call() -> Option { async fn get_latest_version_call() -> Option { let url = "https://mise.en.dev/VERSION"; debug!("checking mise version from {}", url); - match crate::http::HTTP_VERSION_CHECK.get_text(url).await { + match crate::http::HTTP.get_text(url).await { Ok(text) => { debug!("got version {text}"); Some(text.trim().to_string()) diff --git a/src/http.rs b/src/http.rs index 0c62390b3c..74c58e727e 100644 --- a/src/http.rs +++ b/src/http.rs @@ -23,10 +23,6 @@ use crate::ui::progress_report::SingleReport; use crate::ui::time::format_duration; use crate::{env, file}; -#[cfg(not(test))] -pub static HTTP_VERSION_CHECK: Lazy = - Lazy::new(|| Client::new(Duration::from_secs(3), ClientKind::VersionCheck).unwrap()); - pub static HTTP: Lazy = Lazy::new(|| Client::new(Settings::get().http_timeout(), ClientKind::Http).unwrap()); @@ -57,8 +53,6 @@ pub struct Client { enum ClientKind { Http, Fetch, - #[allow(dead_code)] - VersionCheck, } impl Client { @@ -457,23 +451,14 @@ impl Client { "fetch_remote_versions_timeout", "MISE_FETCH_REMOTE_VERSIONS_TIMEOUT", ), - ClientKind::VersionCheck => ("version_check_timeout", ""), - }; - let hint = if env_var.is_empty() { - format!( - "HTTP timed out after {} for {}.", - format_duration(self.timeout), - url - ) - } else { - format!( - "HTTP timed out after {} for {} (change with `{}` or env `{}`).", - format_duration(self.timeout), - url, - setting, - env_var - ) }; + let hint = format!( + "HTTP timed out after {} for {} (change with `{}` or env `{}`).", + format_duration(self.timeout), + url, + setting, + env_var + ); // wrap_err preserves the underlying reqwest::Error in the chain so // is_transient() can still classify this as a retryable timeout. return Err(Report::new(err).wrap_err(hint));