fix: allow null status_code in ingest schema; check HTTP status in post_result
This commit is contained in:
@@ -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(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user