summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2018-09-10 23:59:16 +0100
committerMatthew Hodgson <matthew@matrix.org>2018-09-10 23:59:16 +0100
commit8e8dfb4803b9ed8c39f38f6e603b1d8015032cfa (patch)
tree4a66af93e69d461c659cb76460bf44c1d7d8d36e
parentsql that actually compiles (diff)
downloadsynapse-8e8dfb4803b9ed8c39f38f6e603b1d8015032cfa.tar.xz
disable LL for incr syncs, and log incr sync stats
See vector-im/riot-web#7211 for details
-rw-r--r--synapse/handlers/sync.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index 39ef2af08e..2407d4278f 100644
--- a/synapse/handlers/sync.py
+++ b/synapse/handlers/sync.py
@@ -736,6 +736,13 @@ class SyncHandler(object):
                     lazy_load_members=lazy_load_members,
                 )
             elif batch.limited:
+                # for now, we disable LL for gappy syncs - see
+                # https://github.com/vector-im/riot-web/issues/7211#issuecomment-419976346
+                # N.B. this slows down incr syncs as we are now processing way
+                # more state in the server than if we were LLing.
+                types = None
+                filtered_types = None
+
                 state_at_previous_sync = yield self.get_state_at(
                     room_id, stream_position=since_token, types=types,
                     filtered_types=filtered_types,
@@ -756,13 +763,13 @@ class SyncHandler(object):
                     timeline_start=state_at_timeline_start,
                     previous=state_at_previous_sync,
                     current=current_state_ids,
-                    lazy_load_members=lazy_load_members,
+                    lazy_load_members=False,  # N.B. overridden to disable LL
                 )
             else:
                 state_ids = {}
                 if lazy_load_members:
                     if types:
-                        # We're returning an incremental (or initial) sync, with no
+                        # We're returning an incremental sync, with no
                         # "gap" since the previous sync, so normally there would be
                         # no state to return.
                         # But we're lazy-loading, so the client might need some more
@@ -1681,6 +1688,16 @@ class SyncHandler(object):
                     unread_notifications["highlight_count"] = notifs["highlight_count"]
 
                 sync_result_builder.joined.append(room_sync)
+
+            if batch.limited:
+                user_id = sync_result_builder.sync_config.user.to_string()
+                logger.info(
+                    "Incremental syncing room %s for user %s with %d state events" % (
+                        room_id,
+                        user_id,
+                        len(state),
+                    )
+                )
         elif room_builder.rtype == "archived":
             room_sync = ArchivedSyncResult(
                 room_id=room_id,