From 07dfe148de2fbc6eb22be662ed8216a6e11f6811 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Thu, 31 Jan 2019 18:30:40 +0000 Subject: [PATCH] Add some debug for membership syncing issues (#4538) I can't figure out what's going on with #4422 and #4436; perhaps this will help. --- changelog.d/4538.misc | 1 + synapse/handlers/sync.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 changelog.d/4538.misc diff --git a/changelog.d/4538.misc b/changelog.d/4538.misc new file mode 100644 index 000000000..dbc878b09 --- /dev/null +++ b/changelog.d/4538.misc @@ -0,0 +1 @@ +Add some debug for membership syncing issues diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 28857bfc1..bd97241ab 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -895,14 +895,17 @@ class SyncHandler(object): Returns: Deferred(SyncResult) """ - logger.info("Calculating sync response for %r", sync_config.user) - # NB: The now_token gets changed by some of the generate_sync_* methods, # this is due to some of the underlying streams not supporting the ability # to query up to a given point. # Always use the `now_token` in `SyncResultBuilder` now_token = yield self.event_sources.get_current_token() + logger.info( + "Calculating sync response for %r between %s and %s", + sync_config.user, since_token, now_token, + ) + user_id = sync_config.user.to_string() app_service = self.store.get_app_service_by_user_id(user_id) if app_service: @@ -1390,6 +1393,12 @@ class SyncHandler(object): room_entries = [] invited = [] for room_id, events in iteritems(mem_change_events_by_room_id): + logger.info( + "Membership changes in %s: [%s]", + room_id, + ", ".join(("%s (%s)" % (e.event_id, e.membership) for e in events)), + ) + non_joins = [e for e in events if e.membership != Membership.JOIN] has_join = len(non_joins) != len(events)