diff options
author | Erik Johnston <erikj@jki.re> | 2017-03-16 13:05:17 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-16 13:05:16 +0000 |
commit | 248eb4638d45b10e22820d5d03ab504e927a8422 (patch) | |
tree | c66ca7b4f6ad2bdcc22d017d72bbdf1145d1147d /synapse/storage | |
parent | Merge pull request #2014 from Half-Shot/hs/fix-appservice-presence (diff) | |
parent | Comments (diff) | |
download | synapse-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.py | 13 |
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) |