summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-09-26 10:08:59 +0100
committerErik Johnston <erik@matrix.org>2017-09-26 10:08:59 +0100
commit1a398b19fd3ca6cb0e0bf22011407404cd327c72 (patch)
tree3404f5893e9085a5cbe3e248b370efd099fc260e /synapse
parentBump changelog and version (diff)
parentMerge pull request #2470 from matrix-org/erikj/sync_speed_fix (diff)
downloadsynapse-1a398b19fd3ca6cb0e0bf22011407404cd327c72.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into release-v0.23.0 v0.23.0-rc2
Diffstat (limited to 'synapse')
-rw-r--r--synapse/crypto/keyring.py2
-rw-r--r--synapse/handlers/sync.py23
2 files changed, 19 insertions, 6 deletions
diff --git a/synapse/crypto/keyring.py b/synapse/crypto/keyring.py

index 2a1d383078..054bac456d 100644 --- a/synapse/crypto/keyring.py +++ b/synapse/crypto/keyring.py
@@ -298,7 +298,7 @@ class Keyring(object): break with PreserveLoggingContext(): - for verify_request in requests_missing_keys.values(): + for verify_request in requests_missing_keys: verify_request.deferred.errback(SynapseError( 401, "No key for %s with id %s" % ( diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index af1b527840..dd0ec00ae6 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py
@@ -293,11 +293,6 @@ class SyncHandler(object): timeline_limit = sync_config.filter_collection.timeline_limit() block_all_timeline = sync_config.filter_collection.blocks_all_room_timeline() - # Pull out the current state, as we always want to include those events - # in the timeline if they're there. - current_state_ids = yield self.state.get_current_state_ids(room_id) - current_state_ids = frozenset(current_state_ids.itervalues()) - if recents is None or newly_joined_room or timeline_limit < len(recents): limited = True else: @@ -305,6 +300,15 @@ class SyncHandler(object): if recents: recents = sync_config.filter_collection.filter_room_timeline(recents) + + # We check if there are any state events, if there are then we pass + # all current state events to the filter_events function. This is to + # ensure that we always include current state in the timeline + current_state_ids = frozenset() + if any(e.is_state() for e in recents): + current_state_ids = yield self.state.get_current_state_ids(room_id) + current_state_ids = frozenset(current_state_ids.itervalues()) + recents = yield filter_events_for_client( self.store, sync_config.user.to_string(), @@ -341,6 +345,15 @@ class SyncHandler(object): loaded_recents = sync_config.filter_collection.filter_room_timeline( events ) + + # We check if there are any state events, if there are then we pass + # all current state events to the filter_events function. This is to + # ensure that we always include current state in the timeline + current_state_ids = frozenset() + if any(e.is_state() for e in loaded_recents): + current_state_ids = yield self.state.get_current_state_ids(room_id) + current_state_ids = frozenset(current_state_ids.itervalues()) + loaded_recents = yield filter_events_for_client( self.store, sync_config.user.to_string(),