diff options
author | Erik Johnston <erikj@jki.re> | 2018-10-25 17:49:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-25 17:49:55 +0100 |
commit | cb53ce9d6429252d5ee012f5a476cc834251c27d (patch) | |
tree | 90be05442144fa134496da612e850855e2c84b18 /synapse/handlers/initial_sync.py | |
parent | Merge remote-tracking branch 'origin/master' into develop (diff) | |
download | synapse-cb53ce9d6429252d5ee012f5a476cc834251c27d.tar.xz |
Refactor state group lookup to reduce DB hits (#4011)
Currently when fetching state groups from the data store we make two hits two the database: once for members and once for non-members (unless request is filtered to one or the other). This adds needless load to the datbase, so this PR refactors the lookup to make only a single database hit.
Diffstat (limited to 'synapse/handlers/initial_sync.py')
-rw-r--r-- | synapse/handlers/initial_sync.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/handlers/initial_sync.py b/synapse/handlers/initial_sync.py index e009395207..563bb3cea3 100644 --- a/synapse/handlers/initial_sync.py +++ b/synapse/handlers/initial_sync.py @@ -156,7 +156,7 @@ class InitialSyncHandler(BaseHandler): room_end_token = "s%d" % (event.stream_ordering,) deferred_room_state = run_in_background( self.store.get_state_for_events, - [event.event_id], None, + [event.event_id], ) deferred_room_state.addCallback( lambda states: states[event.event_id] @@ -301,7 +301,7 @@ class InitialSyncHandler(BaseHandler): def _room_initial_sync_parted(self, user_id, room_id, pagin_config, membership, member_event_id, is_peeking): room_state = yield self.store.get_state_for_events( - [member_event_id], None + [member_event_id], ) room_state = room_state[member_event_id] |