Add "database_memory_usage" AdminCommand
This commit is contained in:
parent
71431f330a
commit
ff243870f8
2 changed files with 11 additions and 0 deletions
|
@ -14,6 +14,7 @@ pub enum AdminCommand {
|
|||
RegisterAppservice(serde_yaml::Value),
|
||||
UnregisterAppservice(String),
|
||||
ListAppservices,
|
||||
ShowMemoryUsage,
|
||||
SendMessage(RoomMessageEventContent),
|
||||
}
|
||||
|
||||
|
@ -113,6 +114,13 @@ impl Admin {
|
|||
send_message(RoomMessageEventContent::text_plain("Failed to get appservices."), guard, &state_lock);
|
||||
}
|
||||
}
|
||||
AdminCommand::ShowMemoryUsage => {
|
||||
if let Ok(response) = guard._db.memory_usage() {
|
||||
send_message(RoomMessageEventContent::text_plain(response), guard, &state_lock);
|
||||
} else {
|
||||
send_message(RoomMessageEventContent::text_plain("Failed to get database memory usage".to_string()), guard, &state_lock);
|
||||
}
|
||||
}
|
||||
AdminCommand::SendMessage(message) => {
|
||||
send_message(message, guard, &state_lock);
|
||||
}
|
||||
|
|
|
@ -1693,6 +1693,9 @@ impl Rooms {
|
|||
));
|
||||
}
|
||||
}
|
||||
"database_memory_usage" => {
|
||||
db.admin.send(AdminCommand::ShowMemoryUsage);
|
||||
}
|
||||
_ => {
|
||||
db.admin.send(AdminCommand::SendMessage(
|
||||
RoomMessageEventContent::text_plain(format!(
|
||||
|
|
Loading…
Add table
Reference in a new issue