From 4daa397a00b1b7080686fde34a3858342e4b0498 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 26 Aug 2016 13:02:08 +0100 Subject: [PATCH] Add is_host_joined to slave storage --- synapse/replication/slave/storage/events.py | 2 ++ synapse/storage/roommember.py | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/synapse/replication/slave/storage/events.py b/synapse/replication/slave/storage/events.py index 3a71e7b292..65e982a0ce 100644 --- a/synapse/replication/slave/storage/events.py +++ b/synapse/replication/slave/storage/events.py @@ -127,6 +127,8 @@ class SlavedEventStore(BaseSlavedStore): get_room_events_stream_for_rooms = ( DataStore.get_room_events_stream_for_rooms.__func__ ) + is_host_joined = DataStore.is_host_joined.__func__ + _is_host_joined = RoomMemberStore.__dict__["_is_host_joined"] get_stream_token_for_event = DataStore.get_stream_token_for_event.__func__ _set_before_and_after = staticmethod(DataStore._set_before_and_after) diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py index 5ce5e8da37..5f15200c20 100644 --- a/synapse/storage/roommember.py +++ b/synapse/storage/roommember.py @@ -396,6 +396,7 @@ class RoomMemberStore(SQLBaseStore): keyvalues={ "membership": Membership.JOIN, }, + batch_size=1000, desc="_get_joined_users_from_context", ) @@ -409,8 +410,8 @@ class RoomMemberStore(SQLBaseStore): # To do this we set the state_group to a new object as object() != object() state_group = object() - return self._get_joined_users_from_context( - room_id, state_group, state_ids + return self._is_host_joined( + room_id, host, state_group, state_ids ) @cachedInlineCallbacks(num_args=3) @@ -430,7 +431,7 @@ class RoomMemberStore(SQLBaseStore): logger.warn("state_key not user_id: %s", state_key) continue - event = yield self.store.get_event(event_id, allow_none=True) + event = yield self.get_event(event_id, allow_none=True) if event and event.content["membership"] == Membership.JOIN: defer.returnValue(True)