fix: improve locks

This commit is contained in:
Timo Kösters 2021-08-03 11:10:58 +02:00
parent 6b06fc9707
commit 0eeba86b32
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
12 changed files with 153 additions and 134 deletions

View file

@ -259,15 +259,15 @@ pub async fn send_state_event_for_key_helper(
}
}
let mutex = Arc::clone(
let mutex_state = Arc::clone(
db.globals
.roomid_mutex
.roomid_mutex_state
.write()
.unwrap()
.entry(room_id.clone())
.or_default(),
);
let mutex_lock = mutex.lock().await;
let state_lock = mutex_state.lock().await;
let event_id = db.rooms.build_and_append_pdu(
PduBuilder {
@ -280,7 +280,7 @@ pub async fn send_state_event_for_key_helper(
&sender_user,
&room_id,
&db,
&mutex_lock,
&state_lock,
)?;
Ok(event_id)