fix(maestro): keep the TUI's two request budgets separate
ci / rust (pull_request) Successful in 5m9s
ci / rust (pull_request) Successful in 5m9s
Collapsing the health probe and the app client into one lost both policies: the probe's 500ms was a total request timeout, not a connect timeout, and the app's calls had 5s rather than the client default 30s. A daemon that accepts TCP and then stalls held the terminal for 30s. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
02356f84ab
commit
39cfa50d68
@@ -62,14 +62,15 @@ pub async fn run(cfg: RunConfig) -> Result<(), TuiError> {
|
||||
|
||||
let base_url = cfg.daemon_url.trim_end_matches('/').to_string();
|
||||
|
||||
let daemon = DaemonClient::with_timeouts(
|
||||
// Health check — fail fast if no daemon is reachable.
|
||||
health_check(&DaemonClient::with_timeouts(
|
||||
&base_url,
|
||||
HEALTH_TIMEOUT,
|
||||
maestro_protocol::client::DEFAULT_REQUEST_TIMEOUT,
|
||||
);
|
||||
HEALTH_TIMEOUT,
|
||||
))
|
||||
.await?;
|
||||
|
||||
// Health check — fail fast if no daemon is reachable.
|
||||
health_check(&daemon).await?;
|
||||
let daemon = DaemonClient::with_timeouts(&base_url, REQUEST_TIMEOUT, REQUEST_TIMEOUT);
|
||||
|
||||
// Load runtime config: explicit `--config <path>` wins, then
|
||||
// `$MAESTRO_CONFIG`, then the platform default. Missing file is fine —
|
||||
@@ -105,10 +106,15 @@ pub async fn run(cfg: RunConfig) -> Result<(), TuiError> {
|
||||
app.run(&mut terminal).await
|
||||
}
|
||||
|
||||
/// Startup probe budget. Deliberately far below the client default: the user is
|
||||
/// Startup probe budget, applied to connect *and* the whole request: the user is
|
||||
/// staring at a terminal, so an unreachable daemon must fail in under a second.
|
||||
const HEALTH_TIMEOUT: Duration = Duration::from_millis(500);
|
||||
|
||||
/// Budget for the TUI's own calls once it is up. Tighter than the client
|
||||
/// default — a spawn or kill that stalls should surface as a toast, not hang
|
||||
/// the interface.
|
||||
const REQUEST_TIMEOUT: Duration = Duration::from_secs(5);
|
||||
|
||||
async fn health_check(daemon: &DaemonClient) -> Result<(), TuiError> {
|
||||
for _ in 0..3 {
|
||||
if daemon.daemon_info().await.is_ok() {
|
||||
|
||||
Reference in New Issue
Block a user