Merge pull request #1093 from matrix-org/erikj/dedupe_presence

Deduplicate presence in _update_states
This commit is contained in:
Erik Johnston 2016-09-09 14:45:21 +01:00 committed by GitHub
commit ea05155a8c
1 changed files with 6 additions and 0 deletions

View File

@ -265,6 +265,12 @@ class PresenceHandler(object):
to_notify = {} # Changes we want to notify everyone about to_notify = {} # Changes we want to notify everyone about
to_federation_ping = {} # These need sending keep-alives to_federation_ping = {} # These need sending keep-alives
# Only bother handling the last presence change for each user
new_states_dict = {}
for new_state in new_states:
new_states_dict[new_state.user_id] = new_state
new_state = new_states_dict.values()
for new_state in new_states: for new_state in new_states:
user_id = new_state.user_id user_id = new_state.user_id