fix: don't need all services to be present

this way disabling a service won't break it
This commit is contained in:
əlemi 2024-12-10 22:01:43 +01:00
parent 7dff1a9f78
commit 12ba835223
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -63,10 +63,9 @@ async fn api_status(
let five_min_ago = (chrono::Utc::now() - chrono::Duration::minutes(5)).timestamp(); let five_min_ago = (chrono::Utc::now() - chrono::Duration::minutes(5)).timestamp();
let since = q.since.unwrap_or(five_min_ago); let since = q.since.unwrap_or(five_min_ago);
for (sid, name) in db.services().await? { for (sid, name) in db.services().await? {
state.insert( if let Ok(up) = db.up(sid, since).await {
name, state.insert(name, up);
db.up(sid, since).await? }
);
} }
Ok(Json(state)) Ok(Json(state))
} }