fix: allow null status_code in ingest schema; check HTTP status in post_result

This commit is contained in:
M1
2026-03-18 13:28:42 +04:00
parent 5037222846
commit 6e1d642c77
2 changed files with 9 additions and 3 deletions
+7 -1
View File
@@ -342,7 +342,7 @@ async fn post_result(
token: &str,
result: PingResult,
) -> Result<()> {
tokio::time::timeout(
let resp = tokio::time::timeout(
std::time::Duration::from_secs(10),
client
.post(format!("{coordinator_url}/internal/ingest"))
@@ -352,5 +352,11 @@ async fn post_result(
).await
.map_err(|_| anyhow::anyhow!("post_result timed out"))?
.map_err(|e| anyhow::anyhow!("{e}"))?;
if !resp.status().is_success() {
let status = resp.status();
let body = resp.text().await.unwrap_or_default();
return Err(anyhow::anyhow!("ingest returned {status}: {body}"));
}
Ok(())
}