From cc41ca8ccbcf102cacc18ea8a78cb5063d49c363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A7=E9=A9=8A?= Date: Sun, 8 Nov 2026 01:05:31 +0800 Subject: [PATCH] Firefox gets longer to start (a Snap's first start after boot is slow) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uirha2RVfSYmrhqNnqx9Z4 --- src/botbrowser.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/botbrowser.rs b/src/botbrowser.rs index db76568..37f8ff8 100644 --- a/src/botbrowser.rs +++ b/src/botbrowser.rs @@ -22,6 +22,8 @@ use std::time::{Duration, Instant}; pub const PORT: u16 = 9333; /// How long to wait for the browser to come up (estimated). const START_TIMEOUT_SECS: u64 = 20; +/// Firefox from a Snap can take much longer the first time after the computer starts (estimated). +const FIREFOX_START_TIMEOUT_SECS: u64 = 60; /// The first profile: the browser folder made before profiles existed (its logins stay). pub const DEFAULT_PROFILE: &str = "預設"; /// The person's own browser (read through accessibility, like Grok Bot's Computer Use helper): @@ -703,7 +705,7 @@ fn ensure_firefox(profile: &str, dir: &std::path::Path, first_url: Option<&str>) } c.spawn().map_err(|e| format!("打不開 Firefox:{e}"))?; let start = Instant::now(); - while start.elapsed() < Duration::from_secs(START_TIMEOUT_SECS) { + while start.elapsed() < Duration::from_secs(FIREFOX_START_TIMEOUT_SECS) { if let Some(p) = firefox_port(dir) { return Ok(("Firefox", p, true)); }