Skip to content

Commit fbcf9fc

Browse files
committed
feat(sdk): Add more logs in EventCache.
This patch adds more logs inside `EventCache` around the `multiple_room_updates_lock` and around the `listen_task`, just to be sure if everything is listened and works as expected.
1 parent 6de4032 commit fbcf9fc

File tree

1 file changed

+9
-1
lines changed
  • crates/matrix-sdk/src/event_cache

1 file changed

+9
-1
lines changed

crates/matrix-sdk/src/event_cache/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ use matrix_sdk_base::{
4242
linked_chunk::lazy_loader::LazyLoaderError,
4343
store_locks::LockStoreError,
4444
sync::RoomUpdates,
45+
timer,
4546
};
4647
use matrix_sdk_common::executor::{spawn, JoinHandle};
4748
use room::RoomEventCacheState;
@@ -252,6 +253,8 @@ impl EventCache {
252253
loop {
253254
match room_updates_feed.recv().await {
254255
Ok(updates) => {
256+
trace!("Receiving `RoomUpdates`");
257+
255258
if let Err(err) = inner.handle_room_updates(updates).await {
256259
match err {
257260
EventCacheError::ClientDropped => {
@@ -511,7 +514,10 @@ impl EventCacheInner {
511514
async fn handle_room_updates(&self, updates: RoomUpdates) -> Result<()> {
512515
// First, take the lock that indicates we're processing updates, to avoid
513516
// handling multiple updates concurrently.
514-
let _lock = self.multiple_room_updates_lock.lock().await;
517+
let _lock = {
518+
let _timer = timer!("Taking the `multiple_room_updates_lock`");
519+
self.multiple_room_updates_lock.lock().await
520+
};
515521

516522
// Left rooms.
517523
for (room_id, left_room_update) in updates.left {
@@ -525,6 +531,8 @@ impl EventCacheInner {
525531

526532
// Joined rooms.
527533
for (room_id, joined_room_update) in updates.joined {
534+
trace!(?room_id, "Handling a `JoinedRoomUpdate`");
535+
528536
let room = self.for_room(&room_id).await?;
529537

530538
if let Err(err) = room.inner.handle_joined_room_update(joined_room_update).await {

0 commit comments

Comments
 (0)