Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Add some debug for membership syncing issues (#4538)
Browse files Browse the repository at this point in the history
I can't figure out what's going on with #4422 and #4436; perhaps this will help.
  • Loading branch information
richvdh authored Jan 31, 2019
1 parent e707e7b commit 07dfe14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/4538.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add some debug for membership syncing issues
13 changes: 11 additions & 2 deletions synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,14 +895,17 @@ def generate_sync_result(self, sync_config, since_token=None, full_state=False):
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:
Expand Down Expand Up @@ -1390,6 +1393,12 @@ def _get_rooms_changed(self, sync_result_builder, ignored_users):
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)

Expand Down

0 comments on commit 07dfe14

Please sign in to comment.