fix: fire-and-forget checks so slow monitors don't delay fast ones
This commit is contained in:
@@ -25,8 +25,8 @@ pub async fn fetch_and_run(
|
||||
let n = monitors.len();
|
||||
if n == 0 { return Ok(0); }
|
||||
|
||||
// Run all checks concurrently
|
||||
let tasks: Vec<_> = monitors.into_iter().map(|monitor| {
|
||||
// Spawn all checks — fire and forget, don't block the cycle
|
||||
for monitor in monitors {
|
||||
let client = client.clone();
|
||||
let coordinator_url = coordinator_url.to_string();
|
||||
let token = token.to_string();
|
||||
@@ -35,10 +35,9 @@ pub async fn fetch_and_run(
|
||||
if let Err(e) = post_result(&client, &coordinator_url, &token, result).await {
|
||||
warn!("Failed to post result for {}: {e}", monitor.id);
|
||||
}
|
||||
})
|
||||
}).collect();
|
||||
});
|
||||
}
|
||||
|
||||
futures::future::join_all(tasks).await;
|
||||
Ok(n)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user