summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2022-08-23 15:14:05 +0100
committerGitHub <noreply@github.com>2022-08-23 14:14:05 +0000
commit05c9c7363b09d2517a79915b831ce423c7defc7e (patch)
tree23178697340bbfba9726819b44440f02055455a3
parentUpdate openid.md (#13568) (diff)
downloadsynapse-05c9c7363b09d2517a79915b831ce423c7defc7e.tar.xz
Fix regression caused by #13573 (#13600)
Broke in #13573. 
-rw-r--r--changelog.d/13600.misc1
-rw-r--r--synapse/storage/databases/main/roommember.py10
2 files changed, 7 insertions, 4 deletions
diff --git a/changelog.d/13600.misc b/changelog.d/13600.misc
new file mode 100644
index 0000000000..1ce9c0c081
--- /dev/null
+++ b/changelog.d/13600.misc
@@ -0,0 +1 @@
+Cache user IDs instead of profiles to reduce cache memory usage. Contributed by Nick @ Beeper (@fizzadar).
diff --git a/synapse/storage/databases/main/roommember.py b/synapse/storage/databases/main/roommember.py
index 0eb024a809..046ad3a11c 100644
--- a/synapse/storage/databases/main/roommember.py
+++ b/synapse/storage/databases/main/roommember.py
@@ -916,7 +916,9 @@ class RoomMemberWorkerStore(EventsWorkerStore):
             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:
@@ -942,15 +944,15 @@ class RoomMemberWorkerStore(EventsWorkerStore):
     )
     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(