From 5cf22f0596fa142fe81bb9c8705d445131487a68 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Thu, 29 Oct 2015 19:58:51 +0000 Subject: [PATCH 1/2] Don't mark newly joined room timelines as limited in an incremental sync --- synapse/handlers/sync.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 8601f2217..04f2d46d1 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -387,7 +387,7 @@ class SyncHandler(BaseHandler): else: prev_batch = now_token - state = yield self.check_joined_room( + state, limited = yield self.check_joined_room( sync_config, room_id, state ) @@ -396,7 +396,7 @@ class SyncHandler(BaseHandler): timeline=TimelineBatch( events=recents, prev_batch=prev_batch, - limited=False, + limited=limited, ), state=state, ephemeral=typing_by_room.get(room_id, []) @@ -627,6 +627,7 @@ class SyncHandler(BaseHandler): @defer.inlineCallbacks def check_joined_room(self, sync_config, room_id, state_delta): joined = False + limited = False for event in state_delta: if ( event.type == EventTypes.Member @@ -638,5 +639,6 @@ class SyncHandler(BaseHandler): if joined: res = yield self.state_handler.get_current_state(room_id) state_delta = res.values() + limited = True - defer.returnValue(state_delta) + defer.returnValue((state_delta, limited)) From d58edd98e91ad041a31a96980002c2d8899a2580 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Fri, 30 Oct 2015 11:15:37 +0000 Subject: [PATCH 2/2] Update the other place check_joined_room is called --- synapse/events/utils.py | 3 ++- synapse/handlers/sync.py | 2 +- tox.ini | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/synapse/events/utils.py b/synapse/events/utils.py index 48548f8c4..9989b7659 100644 --- a/synapse/events/utils.py +++ b/synapse/events/utils.py @@ -154,7 +154,8 @@ def serialize_event(e, time_now_ms, as_client_event=True, if "redacted_because" in e.unsigned: d["unsigned"]["redacted_because"] = serialize_event( - e.unsigned["redacted_because"], time_now_ms + e.unsigned["redacted_because"], time_now_ms, + event_format=event_format ) if token_id is not None: diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 04f2d46d1..4c5a2353b 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -520,7 +520,7 @@ class SyncHandler(BaseHandler): current_state=current_state_events, ) - state_events_delta = yield self.check_joined_room( + state_events_delta, _ = yield self.check_joined_room( sync_config, room_id, state_events_delta ) diff --git a/tox.ini b/tox.ini index a69948484..01b23e6bd 100644 --- a/tox.ini +++ b/tox.ini @@ -19,6 +19,7 @@ commands = check-manifest [testenv:pep8] +skip_install = True basepython = python2.7 deps = flake8