Firefox gets longer to start (a Snap's first start after boot is slow)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2RVfSYmrhqNnqx9Z4
This commit is contained in:
parent
ebaedecbae
commit
cc41ca8ccb
|
|
@ -22,6 +22,8 @@ use std::time::{Duration, Instant};
|
||||||
pub const PORT: u16 = 9333;
|
pub const PORT: u16 = 9333;
|
||||||
/// How long to wait for the browser to come up (estimated).
|
/// How long to wait for the browser to come up (estimated).
|
||||||
const START_TIMEOUT_SECS: u64 = 20;
|
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).
|
/// The first profile: the browser folder made before profiles existed (its logins stay).
|
||||||
pub const DEFAULT_PROFILE: &str = "預設";
|
pub const DEFAULT_PROFILE: &str = "預設";
|
||||||
/// The person's own browser (read through accessibility, like Grok Bot's Computer Use helper):
|
/// 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}"))?;
|
c.spawn().map_err(|e| format!("打不開 Firefox:{e}"))?;
|
||||||
let start = Instant::now();
|
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) {
|
if let Some(p) = firefox_port(dir) {
|
||||||
return Ok(("Firefox", p, true));
|
return Ok(("Firefox", p, true));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue