From be3d17ac95674bf9a2597c7301d42e7d0ffc786b Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 11 Sep 2024 10:51:59 -0500 Subject: [PATCH] Trace `get_sliding_sync_rooms_for_user(...)` --- synapse/handlers/sliding_sync/room_lists.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/synapse/handlers/sliding_sync/room_lists.py b/synapse/handlers/sliding_sync/room_lists.py index 165b15c60f..50cca47b5f 100644 --- a/synapse/handlers/sliding_sync/room_lists.py +++ b/synapse/handlers/sliding_sync/room_lists.py @@ -219,9 +219,12 @@ class SlidingSyncRoomLists: # include rooms that are outside the list ranges. all_rooms: Set[str] = set() - room_membership_for_user_map = await self.store.get_sliding_sync_rooms_for_user( - user_id - ) + # We can't trace the function directly because it's cached and the `@cached` + # decorator doesn't mix with `@trace` yet. + with start_active_span("get_sliding_sync_rooms_for_user"): + room_membership_for_user_map = ( + await self.store.get_sliding_sync_rooms_for_user(user_id) + ) changes = await self._get_rewind_changes_to_current_membership_to_token( sync_config.user, room_membership_for_user_map, to_token=to_token