delete unnecessary real_users_cache
, fix overwriting push_target iter, add proper function for getting local active users in room
this `real_users_cache` cache seems weird, and i have no idea what prompted its creation upstream. perhaps they did this because sqlite was very slow and their rocksdb setup is very poor, so a "solution" was to stick member counts in memory. slow iterators, scanning, etc do not apply to conduwuit where our rocksdb is extremely tuned, and i seriously doubt something like this would have any real world net-positive performance impact. also for some reason, there is suspicious logic where we overwrite the entire push target collection. both of these things could be a potential cause for receiving notifications in rooms we've left. Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
c1227340b3
commit
c738c119f8
6 changed files with 30 additions and 58 deletions
|
@ -177,19 +177,16 @@ impl Data for KeyValueDatabase {
|
|||
|
||||
fn memory_usage(&self) -> String {
|
||||
let auth_chain_cache = self.auth_chain_cache.lock().unwrap().len();
|
||||
let our_real_users_cache = self.our_real_users_cache.read().unwrap().len();
|
||||
let appservice_in_room_cache = self.appservice_in_room_cache.read().unwrap().len();
|
||||
let lasttimelinecount_cache = self.lasttimelinecount_cache.lock().unwrap().len();
|
||||
|
||||
let max_auth_chain_cache = self.auth_chain_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();
|
||||
|
||||
format!(
|
||||
"\
|
||||
auth_chain_cache: {auth_chain_cache} / {max_auth_chain_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
|
||||
{}",
|
||||
|
@ -203,14 +200,10 @@ lasttimelinecount_cache: {lasttimelinecount_cache} / {max_lasttimelinecount_cach
|
|||
*c = LruCache::new(c.capacity());
|
||||
}
|
||||
if amount > 2 {
|
||||
let c = &mut *self.our_real_users_cache.write().unwrap();
|
||||
*c = HashMap::new();
|
||||
}
|
||||
if amount > 3 {
|
||||
let c = &mut *self.appservice_in_room_cache.write().unwrap();
|
||||
*c = HashMap::new();
|
||||
}
|
||||
if amount > 4 {
|
||||
if amount > 3 {
|
||||
let c = &mut *self.lasttimelinecount_cache.lock().unwrap();
|
||||
*c = HashMap::new();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue