fix
This commit is contained in:
parent
981ed965a8
commit
1434330545
|
|
@ -26,13 +26,20 @@ pub async fn fetch_and_run(
|
|||
in_flight: &Arc<Mutex<HashSet<String>>>,
|
||||
) -> Result<usize> {
|
||||
let url = format!("{coordinator_url}/internal/due?region={region}&lookahead_ms=2000");
|
||||
let monitors: Vec<Monitor> = client
|
||||
let resp = client
|
||||
.get(&url)
|
||||
.header("x-monitor-token", token)
|
||||
.send()
|
||||
.await?
|
||||
.json()
|
||||
.await?;
|
||||
let status = resp.status();
|
||||
let body = resp.text().await?;
|
||||
let monitors: Vec<Monitor> = match serde_json::from_str(&body) {
|
||||
Ok(m) => m,
|
||||
Err(e) => {
|
||||
let preview: String = body.chars().take(500).collect();
|
||||
anyhow::bail!("/internal/due returned status {status}, body could not be parsed: {e}. Body preview: {preview}");
|
||||
}
|
||||
};
|
||||
|
||||
let n = monitors.len();
|
||||
if n == 0 { return Ok(0); }
|
||||
|
|
|
|||
Loading…
Reference in New Issue