summary refs log tree commit diff
path: root/synapse/handlers/sync.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-03-15 16:01:29 +0000
committerGitHub <noreply@github.com>2017-03-15 16:01:29 +0000
commit9d527191bcd14f51ae43cfccf18a34ecb19df801 (patch)
tree272a697640aaf3c919db0b63967908e89b8f16f5 /synapse/handlers/sync.py
parentMerge pull request #1997 from matrix-org/dbkr/cas_partialdownload (diff)
parentComment (diff)
downloadsynapse-9d527191bcd14f51ae43cfccf18a34ecb19df801.tar.xz
Merge pull request #2013 from matrix-org/erikj/presence_FASTER
Format presence events on the edges instead of reformatting them multiple times
Diffstat (limited to 'synapse/handlers/sync.py')
-rw-r--r--synapse/handlers/sync.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index 5572cb883f..33b7fdfe8d 100644
--- a/synapse/handlers/sync.py
+++ b/synapse/handlers/sync.py
@@ -721,14 +721,14 @@ class SyncHandler(object):
             extra_users_ids.update(users)
         extra_users_ids.discard(user.to_string())
 
-        states = yield self.presence_handler.get_states(
-            extra_users_ids,
-            as_event=True,
-        )
-        presence.extend(states)
+        if extra_users_ids:
+            states = yield self.presence_handler.get_states(
+                extra_users_ids,
+            )
+            presence.extend(states)
 
-        # Deduplicate the presence entries so that there's at most one per user
-        presence = {p["content"]["user_id"]: p for p in presence}.values()
+            # Deduplicate the presence entries so that there's at most one per user
+            presence = {p.user_id: p for p in presence}.values()
 
         presence = sync_config.filter_collection.filter_presence(
             presence