delete useless admin commands

To clear caches, restart the server. We may want to consider adding the
cache sizes and database memory usage as metrics in the future.
This commit is contained in:
Charles Hall 2024-09-30 20:25:23 -07:00
parent 6a44d0af2b
commit e0cf163486
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
7 changed files with 11 additions and 195 deletions

View file

@ -168,64 +168,4 @@ impl Services {
"Services::install was called more than once"
);
}
async fn memory_usage(&self) -> String {
let lazy_load_waiting =
self.rooms.lazy_loading.lazy_load_waiting.lock().await.len();
let server_visibility_cache = self
.rooms
.state_accessor
.server_visibility_cache
.lock()
.unwrap()
.len();
let user_visibility_cache = self
.rooms
.state_accessor
.user_visibility_cache
.lock()
.unwrap()
.len();
let stateinfo_cache =
self.rooms.state_compressor.stateinfo_cache.lock().unwrap().len();
let roomid_spacechunk_cache =
self.rooms.spaces.roomid_spacechunk_cache.lock().await.len();
format!(
"\
lazy_load_waiting: {lazy_load_waiting}
server_visibility_cache: {server_visibility_cache}
user_visibility_cache: {user_visibility_cache}
stateinfo_cache: {stateinfo_cache}
roomid_spacechunk_cache: {roomid_spacechunk_cache}"
)
}
async fn clear_caches(&self, amount: u32) {
if amount > 0 {
self.rooms.lazy_loading.lazy_load_waiting.lock().await.clear();
}
if amount > 1 {
self.rooms
.state_accessor
.server_visibility_cache
.lock()
.unwrap()
.clear();
}
if amount > 2 {
self.rooms
.state_accessor
.user_visibility_cache
.lock()
.unwrap()
.clear();
}
if amount > 3 {
self.rooms.state_compressor.stateinfo_cache.lock().unwrap().clear();
}
if amount > 5 {
self.rooms.spaces.roomid_spacechunk_cache.lock().await.clear();
}
}
}