disable LL for incr syncs, and log incr sync stats

See vector-im/riot-web#7211 for details
This commit is contained in:
Matthew Hodgson 2018-09-10 23:59:16 +01:00
parent 2527370fba
commit 8e8dfb4803

View file

@ -736,6 +736,13 @@ class SyncHandler(object):
lazy_load_members=lazy_load_members, lazy_load_members=lazy_load_members,
) )
elif batch.limited: 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( state_at_previous_sync = yield self.get_state_at(
room_id, stream_position=since_token, types=types, room_id, stream_position=since_token, types=types,
filtered_types=filtered_types, filtered_types=filtered_types,
@ -756,13 +763,13 @@ class SyncHandler(object):
timeline_start=state_at_timeline_start, timeline_start=state_at_timeline_start,
previous=state_at_previous_sync, previous=state_at_previous_sync,
current=current_state_ids, current=current_state_ids,
lazy_load_members=lazy_load_members, lazy_load_members=False, # N.B. overridden to disable LL
) )
else: else:
state_ids = {} state_ids = {}
if lazy_load_members: if lazy_load_members:
if types: 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 # "gap" since the previous sync, so normally there would be
# no state to return. # no state to return.
# But we're lazy-loading, so the client might need some more # 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"] unread_notifications["highlight_count"] = notifs["highlight_count"]
sync_result_builder.joined.append(room_sync) 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": elif room_builder.rtype == "archived":
room_sync = ArchivedSyncResult( room_sync = ArchivedSyncResult(
room_id=room_id, room_id=room_id,