ruptime: fix --all flag behaviour, move filtering to server
Build and test / check (push) Successful in 1m6s
Build and test / build (push) Successful in 1m38s
Build and test / test (push) Successful in 3m10s
Build and test / docs (push) Successful in 3m41s

This commit is contained in:
2026-06-24 13:09:35 +09:00
parent d1e1e30ee6
commit 41d00321d5
2 changed files with 12 additions and 14 deletions
+9 -3
View File
@@ -182,12 +182,18 @@ impl VarlinkRoowhoo2ClientServer {
async fn handle_ruptime_request(&self, all: bool) -> VarlinkRuptimeResponse {
tracing::debug!(all, "Handling Ruptime request");
let store = self.whod_status_store.read().await;
store
.values()
.filter(|status_update| {
all || chrono::Utc::now() - status_update.sendtime < chrono::Duration::hours(1)
})
.cloned()
.map(|mut status_update| {
if !all {
status_update
.users
.retain(|user| user.idle_time < chrono::Duration::hours(1));
}
status_update
})
.collect()
}