Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
fix(cli): give jan update a 15s manifest timeout (#9448)
James Dam9c20454e2eba
diff --git a/src-tauri/jan-cli/src/main.rs b/src-tauri/jan-cli/src/main.rsindex 01218d89b..a87112e24 100644--- a/src-tauri/jan-cli/src/main.rs+++ b/src-tauri/jan-cli/src/main.rs@@ -936,7 +936,7 @@ async fn handle_update(check: bool, force: bool) {use app_lib::core::cli::updater::{self, UpdateOutcome};let result = if check {- updater::check_for_update(std::time::Duration::from_secs(10))+ updater::check_for_update(updater::MANUAL_CHECK_TIMEOUT).await.map(|u| {if u.is_newer() {diff --git a/src-tauri/src/core/cli/updater.rs b/src-tauri/src/core/cli/updater.rsindex c618e15be..2bae3ae6c 100644--- a/src-tauri/src/core/cli/updater.rs+++ b/src-tauri/src/core/cli/updater.rs@@ -25,7 +25,10 @@ use sha2::{Digest, Sha256};use crate::core::updater::custom_updater::SECRET_KEY;use crate::core::updater::hmac_client::SignedRequestHeaders;+/// Silent startup check: must never hold up the CLI.const CHECK_TIMEOUT: Duration = Duration::from_millis(1500);+/// Explicit `jan update`: the user is waiting on it, so be patient.+pub const MANUAL_CHECK_TIMEOUT: Duration = Duration::from_secs(15);const DOWNLOAD_TIMEOUT: Duration = Duration::from_secs(300);const BINARY_NAME: &str = if cfg!(windows) { "jan.exe" } else { "jan" };@@ -470,7 +473,7 @@ fn is_stale(entry: &fs::DirEntry) -> bool {/// Download the newest build for this channel and replace the running binary/// in place. `force` reinstalls even when the versions already match.pub async fn self_update(force: bool) -> Result<UpdateOutcome, String> {- let update = check_for_update(CHECK_TIMEOUT).await?;+ let update = check_for_update(MANUAL_CHECK_TIMEOUT).await?;if !update.is_newer() && !force {return Ok(UpdateOutcome::UpToDate {version: update.current,