Skip to content
Snippets Groups Projects
Commit 016270b3 authored by 🥺's avatar 🥺 :transgender_flag:
Browse files

adminroom: add server_in_room state cache accessor

parent d2063013
No related branches found
No related tags found
1 merge request!455Admin room command improvements, new commands, and log client IP on some requests
......@@ -136,6 +136,11 @@ pub(crate) enum RoomAlias {
#[cfg_attr(test, derive(Debug))]
#[derive(Subcommand)]
pub(crate) enum RoomStateCache {
ServerInRoom {
server: Box<ServerName>,
room_id: Box<RoomId>,
},
RoomServers {
room_id: Box<RoomId>,
},
......
......@@ -5,6 +5,22 @@
pub(crate) async fn room_state_cache(subcommand: RoomStateCache) -> Result<RoomMessageEventContent> {
match subcommand {
RoomStateCache::ServerInRoom {
server,
room_id,
} => {
let timer = tokio::time::Instant::now();
let result = services()
.rooms
.state_cache
.server_in_room(&server, &room_id);
let query_time = timer.elapsed();
Ok(RoomMessageEventContent::text_html(
format!("Query completed in {query_time:?}:\n\n```\n{result:?}```"),
format!("<p>Query completed in {query_time:?}:</p>\n<pre><code>{result:?}\n</code></pre>"),
))
},
RoomStateCache::RoomServers {
room_id,
} => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment