From b813c3464210f249ca4da42dfd8c8c58a5d4a794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20K=C3=B6sters?= Date: Wed, 4 Aug 2021 18:30:56 +0200 Subject: [PATCH] improvement: more auth chain caching --- src/database/rooms.rs | 4 ++-- src/server_server.rs | 17 +++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/database/rooms.rs b/src/database/rooms.rs index 9f7a6005..549aa8cf 100644 --- a/src/database/rooms.rs +++ b/src/database/rooms.rs @@ -87,7 +87,7 @@ pub struct Rooms { pub(super) referencedevents: Arc, pub(super) pdu_cache: Mutex>>, - pub(super) auth_chain_cache: Mutex>>, + pub(super) auth_chain_cache: Mutex, HashSet>>, } impl Rooms { @@ -2618,7 +2618,7 @@ impl Rooms { #[tracing::instrument(skip(self))] pub fn auth_chain_cache( &self, - ) -> std::sync::MutexGuard<'_, LruCache>> { + ) -> std::sync::MutexGuard<'_, LruCache, HashSet>> { self.auth_chain_cache.lock().unwrap() } } diff --git a/src/server_server.rs b/src/server_server.rs index 7b0bd58b..0e595d44 100644 --- a/src/server_server.rs +++ b/src/server_server.rs @@ -1727,9 +1727,13 @@ fn get_auth_chain(starting_events: Vec, db: &Database) -> Result, db: &Database) -> Result