diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 37a2c4ba8b..097456be4f 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -906,15 +906,20 @@ class SyncHandler(object): r.would_require_resync = True _, bottom_ts = cutoff_list[-1] - value = bottom_ts + new_pagination_value = bottom_ts + logger.info("old pagination value: %r", old_pagination_value) + logger.info("New pagination value: %r", new_pagination_value) + + # Are there any rooms that fall into the range between the + # old and new value? limited = any( - old_pagination_value < r[1] < value + old_pagination_value < r[1] < new_pagination_value for r in sorted_list[pagination_limit + extra_limit:] ) sync_result_builder.pagination_state = SyncPaginationState( - order=pagination_config.order, value=value, + order=pagination_config.order, value=new_pagination_value, limit=pagination_limit + extra_limit, tags=pagination_config.tags, ) diff --git a/synapse/rest/client/v2_alpha/sync.py b/synapse/rest/client/v2_alpha/sync.py index 61d013eb57..0f8411f87f 100644 --- a/synapse/rest/client/v2_alpha/sync.py +++ b/synapse/rest/client/v2_alpha/sync.py @@ -200,13 +200,6 @@ class SyncRestServlet(RestServlet): filter_id = parse_string(request, "filter", default=None) full_state = parse_boolean(request, "full_state", default=False) - logger.info( - "/sync: user=%r, timeout=%r, since=%r," - " set_presence=%r, filter_id=%r" % ( - user, timeout, since, set_presence, filter_id - ) - ) - request_key = (user, timeout, since, filter_id, full_state) if filter_id: @@ -255,6 +248,13 @@ class SyncRestServlet(RestServlet): user = sync_config.user + logger.info( + "/sync: user=%r, timeout=%r, since=%r," + " set_presence=%r" % ( + user, timeout, batch_token, set_presence + ) + ) + if affect_presence: yield self.presence_handler.set_state(user, {"presence": set_presence})