add granular conf items for all memory caches

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-04-03 17:27:43 -07:00 committed by June
parent 5c30d2b2b0
commit 568136296f
4 changed files with 85 additions and 12 deletions

View file

@ -12,6 +12,7 @@ use crate::{services, Error, Result};
pub struct Service {
pub db: &'static dyn Data,
pub(crate) shorteventid_cache_capacity: usize,
}
impl Service {
@ -117,6 +118,15 @@ impl Service {
"Auth chain stats",
);
if full_auth_chain.len() > self.shorteventid_cache_capacity {
warn!(
"Room {room_id} requires cache size of {} but it is set to {}. Increase 'shorteventid_cache_capacity' \
in your config file.",
full_auth_chain.len(),
self.shorteventid_cache_capacity,
);
}
Ok(full_auth_chain
.into_iter()
.filter_map(move |sid| services().rooms.short.get_eventid_from_short(sid).ok()))