From 819e35f81fdfb6d7045b24f7fdf7d647e75ffb22 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 14 Jan 2025 08:01:12 +0000 Subject: [PATCH] remove mutex lock/unlock during sync iteration. Signed-off-by: Jason Volk --- src/api/client/sync/v3.rs | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/api/client/sync/v3.rs b/src/api/client/sync/v3.rs index a4dc0205..d6b9f15c 100644 --- a/src/api/client/sync/v3.rs +++ b/src/api/client/sync/v3.rs @@ -242,10 +242,6 @@ pub(crate) async fn build_sync_events( .state_cache .rooms_invited(sender_user) .fold_default(|mut invited_rooms: BTreeMap<_, _>, (room_id, invite_state)| async move { - // Get and drop the lock to wait for remaining operations to finish - let insert_lock = services.rooms.timeline.mutex_insert.lock(&room_id).await; - drop(insert_lock); - let invite_count = services .rooms .state_cache @@ -271,10 +267,6 @@ pub(crate) async fn build_sync_events( .state_cache .rooms_knocked(sender_user) .fold_default(|mut knocked_rooms: BTreeMap<_, _>, (room_id, knock_state)| async move { - // Get and drop the lock to wait for remaining operations to finish - let insert_lock = services.rooms.timeline.mutex_insert.lock(&room_id).await; - drop(insert_lock); - let knock_count = services .rooms .state_cache @@ -470,10 +462,6 @@ async fn handle_left_room( full_state: bool, lazy_load_enabled: bool, ) -> Result> { - // Get and drop the lock to wait for remaining operations to finish - let insert_lock = services.rooms.timeline.mutex_insert.lock(room_id).await; - drop(insert_lock); - let left_count = services .rooms .state_cache @@ -627,11 +615,6 @@ async fn load_joined_room( lazy_load_send_redundant: bool, full_state: bool, ) -> Result<(JoinedRoom, HashSet, HashSet)> { - // Get and drop the lock to wait for remaining operations to finish - // This will make sure the we have all events until next_batch - let insert_lock = services.rooms.timeline.mutex_insert.lock(room_id).await; - drop(insert_lock); - let sincecount = PduCount::Normal(since); let next_batchcount = PduCount::Normal(next_batch);