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,
|
token: &str,
|
||||||
result: PingResult,
|
result: PingResult,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
tokio::time::timeout(
|
||||||
|
std::time::Duration::from_secs(10),
|
||||||
client
|
client
|
||||||
.post(format!("{coordinator_url}/internal/ingest"))
|
.post(format!("{coordinator_url}/internal/ingest"))
|
||||||
.header("x-monitor-token", token)
|
.header("x-monitor-token", token)
|
||||||
.json(&result)
|
.json(&result)
|
||||||
.send()
|
.send()
|
||||||
.await?;
|
).await
|
||||||
|
.map_err(|_| anyhow::anyhow!("post_result timed out"))?
|
||||||
|
.map_err(|e| anyhow::anyhow!("{e}"))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue