erikj/paginate_sync
Erik Johnston 2016-06-27 10:34:52 +01:00
parent 3ace9bdff9
commit c0b2f33dc2
2 changed files with 15 additions and 10 deletions

View File

@ -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,
)

View File

@ -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})