summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-09-09 14:26:05 +0100
committerErik Johnston <erik@matrix.org>2016-09-09 14:28:22 +0100
commit6c4d5821446c861c0448a8d952a7aa40897b1ebd (patch)
tree92f0d383782e555975e80f8880afb3f74a18e46c /synapse
parentMerge pull request #1092 from matrix-org/erikj/transaction_queue_check (diff)
downloadsynapse-6c4d5821446c861c0448a8d952a7aa40897b1ebd.tar.xz
Deduplicate presence in _update_states
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/presence.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py
index 7a3c16a8aa..16dbddee03 100644
--- a/synapse/handlers/presence.py
+++ b/synapse/handlers/presence.py
@@ -265,6 +265,12 @@ class PresenceHandler(object):
             to_notify = {}  # Changes we want to notify everyone about
             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:
                 user_id = new_state.user_id