fix: add 10s timeout to post_result to prevent hung API calls

This commit is contained in:
M1 2026-03-18 13:24:52 +04:00
parent 3ce89a88bf
commit 5037222846
1 changed files with 10 additions and 6 deletions

View File

@ -342,11 +342,15 @@ async fn post_result(
token: &str,
result: PingResult,
) -> Result<()> {
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?;
).await
.map_err(|_| anyhow::anyhow!("post_result timed out"))?
.map_err(|e| anyhow::anyhow!("{e}"))?;
Ok(())
}