fix: add 10s timeout to post_result to prevent hung API calls
This commit is contained in:
parent
3ce89a88bf
commit
5037222846
|
|
@ -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(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue