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

Fix regression caused by #13573 #13600

Merged
merged 3 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/13600.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cache user IDs instead of profiles to reduce cache memory usage. Contributed by Nick @ Beeper (@fizzadar).
10 changes: 6 additions & 4 deletions synapse/storage/databases/main/roommember.py
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,9 @@ async def _get_joined_user_ids_from_context(
event_to_memberships = await self._get_user_ids_from_membership_event_ids(
missing_member_event_ids
)
users_in_room.update(event_to_memberships.values())
users_in_room.update(
user_id for user_id in event_to_memberships.values() if user_id
)

if event is not None and event.type == EventTypes.Member:
if event.membership == Membership.JOIN:
Expand All @@ -942,15 +944,15 @@ def _get_user_id_from_membership_event_id(
)
async def _get_user_ids_from_membership_event_ids(
self, event_ids: Iterable[str]
) -> Dict[str, str]:
) -> Dict[str, Optional[str]]:
"""For given set of member event_ids check if they point to a join
event and if so return the associated user and profile info.
event.

Args:
event_ids: The member event IDs to lookup

Returns:
Map from event ID to `user_id` and ProfileInfo (or None if not join event).
Map from event ID to `user_id`, or None if event is not a join.
"""

rows = await self.db_pool.simple_select_many_batch(
Expand Down