perf: Don't hold state lock when unnecessary

This commit is contained in:
timedout committed 2026-10-16 19:26:27 +01:00
1 parent b0a5caf576
commit 3ebd068013
29 files changed
+92 -139

No files matched your search

+1 -5
View File
@@ -46,8 +46,6 @@ pub(crate) async fn send_message_event_route(
return Err!(Request(Forbidden("Encryption has been disabled")));
}
let state_lock = services.rooms.state.mutex.lock(body.room_id.as_str()).await;
if body.event_type == MessageLikeEventType::CallInvite
&& services.rooms.directory.is_public_room(&body.room_id).await
{
@@ -114,7 +112,7 @@ pub(crate) async fn send_message_event_route(
},
sender_user,
Some(&body.room_id),
&state_lock,
None,
)
.await?;
@@ -125,8 +123,6 @@ pub(crate) async fn send_message_event_route(
event_id.as_bytes(),
);
drop(state_lock);
Ok(send_message_event::v3::Response::new(event_id))
}