diff options
author | Erik Johnston <erikj@jki.re> | 2018-07-24 09:57:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-24 09:57:05 +0100 |
commit | 536bc63a4e6833be9c8700f4382949238f8a4bf4 (patch) | |
tree | 5f804ee05b6472691cd12c5cb51d56453d5a367a /synapse/storage | |
parent | Merge branch 'develop' of github.com:matrix-org/synapse into erikj/client_api... (diff) | |
parent | Merge pull request #3584 from matrix-org/erikj/use_cached (diff) | |
download | synapse-536bc63a4e6833be9c8700f4382949238f8a4bf4.tar.xz |
Merge branch 'develop' into erikj/client_apis_move
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/events.py | 7 | ||||
-rw-r--r-- | synapse/storage/push_rule.py | 7 | ||||
-rw-r--r-- | synapse/storage/roommember.py | 7 |
3 files changed, 16 insertions, 5 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py index 4ff0fdc4ab..c2910094d0 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -549,7 +549,12 @@ class EventsStore(EventsWorkerStore): if ctx.state_group in state_groups_map: continue - state_groups_map[ctx.state_group] = ctx.current_state_ids + # We're only interested in pulling out state that has already + # been cached in the context. We'll pull stuff out of the DB later + # if necessary. + current_state_ids = ctx.get_cached_current_state_ids() + if current_state_ids is not None: + state_groups_map[ctx.state_group] = current_state_ids # We need to map the event_ids to their state groups. First, let's # check if the event is one we're persisting, in which case we can diff --git a/synapse/storage/push_rule.py b/synapse/storage/push_rule.py index be655d287b..af564b1b4e 100644 --- a/synapse/storage/push_rule.py +++ b/synapse/storage/push_rule.py @@ -186,6 +186,7 @@ class PushRulesWorkerStore(ApplicationServiceWorkerStore, defer.returnValue(results) + @defer.inlineCallbacks def bulk_get_push_rules_for_room(self, event, context): state_group = context.state_group if not state_group: @@ -195,9 +196,11 @@ class PushRulesWorkerStore(ApplicationServiceWorkerStore, # To do this we set the state_group to a new object as object() != object() state_group = object() - return self._bulk_get_push_rules_for_room( - event.room_id, state_group, context.current_state_ids, event=event + current_state_ids = yield context.get_current_state_ids(self) + result = yield self._bulk_get_push_rules_for_room( + event.room_id, state_group, current_state_ids, event=event ) + defer.returnValue(result) @cachedInlineCallbacks(num_args=2, cache_context=True) def _bulk_get_push_rules_for_room(self, room_id, state_group, current_state_ids, diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py index 02a802bed9..a27702a7a0 100644 --- a/synapse/storage/roommember.py +++ b/synapse/storage/roommember.py @@ -232,6 +232,7 @@ class RoomMemberWorkerStore(EventsWorkerStore): defer.returnValue(user_who_share_room) + @defer.inlineCallbacks def get_joined_users_from_context(self, event, context): state_group = context.state_group if not state_group: @@ -241,11 +242,13 @@ class RoomMemberWorkerStore(EventsWorkerStore): # 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( - event.room_id, state_group, context.current_state_ids, + current_state_ids = yield context.get_current_state_ids(self) + result = yield self._get_joined_users_from_context( + event.room_id, state_group, current_state_ids, event=event, context=context, ) + defer.returnValue(result) def get_joined_users_from_state(self, room_id, state_entry): state_group = state_entry.state_group |