Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 05c9c73

Browse files
authored
Fix regression caused by #13573 (#13600)
Broke in #13573.
1 parent bdfff9c commit 05c9c73

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

changelog.d/13600.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Cache user IDs instead of profiles to reduce cache memory usage. Contributed by Nick @ Beeper (@fizzadar).

synapse/storage/databases/main/roommember.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,9 @@ async def _get_joined_user_ids_from_context(
916916
event_to_memberships = await self._get_user_ids_from_membership_event_ids(
917917
missing_member_event_ids
918918
)
919-
users_in_room.update(event_to_memberships.values())
919+
users_in_room.update(
920+
user_id for user_id in event_to_memberships.values() if user_id
921+
)
920922

921923
if event is not None and event.type == EventTypes.Member:
922924
if event.membership == Membership.JOIN:
@@ -942,15 +944,15 @@ def _get_user_id_from_membership_event_id(
942944
)
943945
async def _get_user_ids_from_membership_event_ids(
944946
self, event_ids: Iterable[str]
945-
) -> Dict[str, str]:
947+
) -> Dict[str, Optional[str]]:
946948
"""For given set of member event_ids check if they point to a join
947-
event and if so return the associated user and profile info.
949+
event.
948950
949951
Args:
950952
event_ids: The member event IDs to lookup
951953
952954
Returns:
953-
Map from event ID to `user_id` and ProfileInfo (or None if not join event).
955+
Map from event ID to `user_id`, or None if event is not a join.
954956
"""
955957

956958
rows = await self.db_pool.simple_select_many_batch(

0 commit comments

Comments
 (0)