summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-03-16 13:05:17 +0000
committerGitHub <noreply@github.com>2017-03-16 13:05:16 +0000
commit248eb4638d45b10e22820d5d03ab504e927a8422 (patch)
treec66ca7b4f6ad2bdcc22d017d72bbdf1145d1147d /synapse/storage
parentMerge pull request #2014 from Half-Shot/hs/fix-appservice-presence (diff)
parentComments (diff)
downloadsynapse-248eb4638d45b10e22820d5d03ab504e927a8422.tar.xz
Merge pull request #2022 from matrix-org/erikj/no_op_sync
Implement no op for room stream in sync
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/roommember.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py
index 545d3d3a99..e38d8927bf 100644
--- a/synapse/storage/roommember.py
+++ b/synapse/storage/roommember.py
@@ -274,24 +274,27 @@ class RoomMemberStore(SQLBaseStore):
 
         return rows
 
-    @cached(max_entries=500000, iterable=True)
+    @cachedInlineCallbacks(max_entries=500000, iterable=True)
     def get_rooms_for_user(self, user_id):
-        return self.get_rooms_for_user_where_membership_is(
+        """Returns a set of room_ids the user is currently joined to
+        """
+        rooms = yield self.get_rooms_for_user_where_membership_is(
             user_id, membership_list=[Membership.JOIN],
         )
+        defer.returnValue(frozenset(r.room_id for r in rooms))
 
     @cachedInlineCallbacks(max_entries=500000, cache_context=True, iterable=True)
     def get_users_who_share_room_with_user(self, user_id, cache_context):
         """Returns the set of users who share a room with `user_id`
         """
-        rooms = yield self.get_rooms_for_user(
+        room_ids = yield self.get_rooms_for_user(
             user_id, on_invalidate=cache_context.invalidate,
         )
 
         user_who_share_room = set()
-        for room in rooms:
+        for room_id in room_ids:
             user_ids = yield self.get_users_in_room(
-                room.room_id, on_invalidate=cache_context.invalidate,
+                room_id, on_invalidate=cache_context.invalidate,
             )
             user_who_share_room.update(user_ids)