From 8b3c4a528c0ec491ab420374d1c077b5a304ae65 Mon Sep 17 00:00:00 2001 From: strawberry Date: Sun, 21 Apr 2024 18:32:07 -0400 Subject: [PATCH] add get_latest_edu_count admin query cmd Signed-off-by: strawberry --- src/service/admin/query/mod.rs | 4 ++++ src/service/admin/query/sending.rs | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/service/admin/query/mod.rs b/src/service/admin/query/mod.rs index 9606095f..f1473a46 100644 --- a/src/service/admin/query/mod.rs +++ b/src/service/admin/query/mod.rs @@ -143,6 +143,10 @@ pub(crate) enum Globals { /// All the getters and iterators from src/database/key_value/sending.rs pub(crate) enum Sending { ActiveRequests, + + GetLatestEduCount { + server_name: Box, + }, } /// Processes admin query commands diff --git a/src/service/admin/query/sending.rs b/src/service/admin/query/sending.rs index d64546f8..e980a6ee 100644 --- a/src/service/admin/query/sending.rs +++ b/src/service/admin/query/sending.rs @@ -21,5 +21,20 @@ pub(super) async fn sending(subcommand: Sending) -> Result { + let timer = tokio::time::Instant::now(); + let results = services().sending.db.get_latest_educount(&server_name); + let query_time = timer.elapsed(); + + Ok(RoomMessageEventContent::text_html( + format!("Query completed in {query_time:?}:\n\n```\n{:?}```", results), + format!( + "

Query completed in {query_time:?}:

\n
{:?}\n
", + results + ), + )) + }, } }