add get_latest_edu_count admin query cmd

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-04-21 18:32:07 -04:00 committed by June
parent cffe48d2dc
commit 8b3c4a528c
2 changed files with 19 additions and 0 deletions

View file

@ -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<ServerName>,
},
}
/// Processes admin query commands

View file

@ -21,5 +21,20 @@ pub(super) async fn sending(subcommand: Sending) -> Result<RoomMessageEventConte
),
))
},
Sending::GetLatestEduCount {
server_name,
} => {
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!(
"<p>Query completed in {query_time:?}:</p>\n<pre><code>{:?}\n</code></pre>",
results
),
))
},
}
}