From bcabf1bda470ef1097e3432bf8165d8211b275cb Mon Sep 17 00:00:00 2001 From: multi prise Date: Wed, 3 Sep 2025 13:26:10 +0200 Subject: [PATCH] Improve perfomance of build_room_key_bundle --- crates/matrix-sdk-crypto/src/store/mod.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/matrix-sdk-crypto/src/store/mod.rs b/crates/matrix-sdk-crypto/src/store/mod.rs index bb488564c..b1ca5c834 100644 --- a/crates/matrix-sdk-crypto/src/store/mod.rs +++ b/crates/matrix-sdk-crypto/src/store/mod.rs @@ -1580,10 +1580,7 @@ impl Store { &self, room_id: &RoomId, ) -> std::result::Result { - // TODO: make this WAY more efficient. We should only fetch sessions for the - // correct room. - let mut sessions = self.get_inbound_group_sessions().await?; - sessions.retain(|session| session.room_id == room_id); + let sessions = self.get_inbound_group_sessions_by_room_id(room_id).await?; let mut bundle = RoomKeyBundle::default(); for session in sessions {