From d92e8e170fd7dea1c4aaf6a7b72e220a83dbed2c Mon Sep 17 00:00:00 2001 From: strawberry Date: Sat, 6 Apr 2024 20:59:33 -0400 Subject: [PATCH] list max cache capacity in memory-usage admin cmd Signed-off-by: strawberry --- src/database/key_value/globals.rs | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/database/key_value/globals.rs b/src/database/key_value/globals.rs index 1c1f4938..799b78f1 100644 --- a/src/database/key_value/globals.rs +++ b/src/database/key_value/globals.rs @@ -157,16 +157,25 @@ impl service::globals::Data for KeyValueDatabase { let appservice_in_room_cache = self.appservice_in_room_cache.read().unwrap().len(); let lasttimelinecount_cache = self.lasttimelinecount_cache.lock().unwrap().len(); + let max_pdu_cache = self.pdu_cache.lock().unwrap().capacity(); + let max_shorteventid_cache = self.shorteventid_cache.lock().unwrap().capacity(); + let max_auth_chain_cache = self.auth_chain_cache.lock().unwrap().capacity(); + let max_eventidshort_cache = self.eventidshort_cache.lock().unwrap().capacity(); + let max_statekeyshort_cache = self.statekeyshort_cache.lock().unwrap().capacity(); + let max_our_real_users_cache = self.our_real_users_cache.read().unwrap().capacity(); + let max_appservice_in_room_cache = self.appservice_in_room_cache.read().unwrap().capacity(); + let max_lasttimelinecount_cache = self.lasttimelinecount_cache.lock().unwrap().capacity(); + let mut response = format!( "\ -pdu_cache: {pdu_cache} -shorteventid_cache: {shorteventid_cache} -auth_chain_cache: {auth_chain_cache} -eventidshort_cache: {eventidshort_cache} -statekeyshort_cache: {statekeyshort_cache} -our_real_users_cache: {our_real_users_cache} -appservice_in_room_cache: {appservice_in_room_cache} -lasttimelinecount_cache: {lasttimelinecount_cache}\n" +pdu_cache: {pdu_cache} / {max_pdu_cache} +shorteventid_cache: {shorteventid_cache} / {max_shorteventid_cache} +auth_chain_cache: {auth_chain_cache} / {max_auth_chain_cache} +eventidshort_cache: {eventidshort_cache} / {max_eventidshort_cache} +statekeyshort_cache: {statekeyshort_cache} / {max_statekeyshort_cache} +our_real_users_cache: {our_real_users_cache} / {max_our_real_users_cache} +appservice_in_room_cache: {appservice_in_room_cache} / {max_appservice_in_room_cache} +lasttimelinecount_cache: {lasttimelinecount_cache} / {max_lasttimelinecount_cache}\n\n" ); if let Ok(db_stats) = self.db.memory_usage() { response += &db_stats;