From 50372228467fc29f17924b5f976dbc3f7df779d5 Mon Sep 17 00:00:00 2001 From: M1 Date: Wed, 18 Mar 2026 13:24:52 +0400 Subject: [PATCH] fix: add 10s timeout to post_result to prevent hung API calls --- apps/monitor/src/runner.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/monitor/src/runner.rs b/apps/monitor/src/runner.rs index cf4578d..a5dcf8a 100644 --- a/apps/monitor/src/runner.rs +++ b/apps/monitor/src/runner.rs @@ -342,11 +342,15 @@ async fn post_result( token: &str, result: PingResult, ) -> Result<()> { - client - .post(format!("{coordinator_url}/internal/ingest")) - .header("x-monitor-token", token) - .json(&result) - .send() - .await?; + tokio::time::timeout( + std::time::Duration::from_secs(10), + client + .post(format!("{coordinator_url}/internal/ingest")) + .header("x-monitor-token", token) + .json(&result) + .send() + ).await + .map_err(|_| anyhow::anyhow!("post_result timed out"))? + .map_err(|e| anyhow::anyhow!("{e}"))?; Ok(()) }