Skip to content

Commit

Permalink
base: adjust trace logging in memory store (#3659)
Browse files Browse the repository at this point in the history
Now we have more information on which locks are implicated, refine the logs to identify the exact lock.
  • Loading branch information
kegsay authored Jul 5, 2024
1 parent f9a19c5 commit 11cbf84
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/matrix-sdk-base/src/store/memory_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,13 @@ impl StateStore for MemoryStore {
trace!("room state");
{
let mut room_state = self.room_state.write().unwrap();
trace!("room state: got room_state lock");
let mut stripped_room_state = self.stripped_room_state.write().unwrap();
trace!("room state: got stripped_room_state lock");
let mut members = self.members.write().unwrap();
trace!("room state: got members lock");
let mut stripped_members = self.stripped_members.write().unwrap();
trace!("room state: got stripped_members lock");

for (room, event_types) in &changes.state {
for (event_type, events) in event_types {
Expand Down Expand Up @@ -669,6 +673,7 @@ impl StateStore for MemoryStore {
.collect())
}

#[instrument(skip(self, memberships))]
async fn get_user_ids(
&self,
room_id: &RoomId,
Expand Down Expand Up @@ -697,11 +702,12 @@ impl StateStore for MemoryStore {
})
.unwrap_or_default()
}

trace!("getting stripped_members lock");
let v = get_user_ids_inner(&self.stripped_members.read().unwrap(), room_id, memberships);
if !v.is_empty() {
return Ok(v);
}
trace!("getting members lock");
Ok(get_user_ids_inner(&self.members.read().unwrap(), room_id, memberships))
}

Expand Down

0 comments on commit 11cbf84

Please sign in to comment.