summary refs log tree commit diff
path: root/synapse/handlers/presence.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-09-06 17:38:11 +0100
committerEmmanuel ROHEE <manu@Emmanuels-MacBook-Pro.local>2014-09-08 11:28:50 +0200
commit768ff1a850a74141c67f643e46b26884cd149837 (patch)
treec4e180824e5427f588351a0c6ba0b278f0eb9f5d /synapse/handlers/presence.py
parentBump version and changelog (diff)
downloadsynapse-768ff1a850a74141c67f643e46b26884cd149837.tar.xz
Fix race in presence handler where we evicted things from cache while handling a key therein
Diffstat (limited to '')
-rw-r--r--synapse/handlers/presence.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py
index c79bb6ff76..b2af09f090 100644
--- a/synapse/handlers/presence.py
+++ b/synapse/handlers/presence.py
@@ -796,11 +796,12 @@ class PresenceEventSource(object):
         updates = []
         # TODO(paul): use a DeferredList ? How to limit concurrency.
         for observed_user in cachemap.keys():
-            if not (from_key < cachemap[observed_user].serial):
+            cached = cachemap[observed_user]
+            if not (from_key < cached.serial):
                 continue
 
             if (yield self.is_visible(observer_user, observed_user)):
-                updates.append((observed_user, cachemap[observed_user]))
+                updates.append((observed_user, cached))
 
         # TODO(paul): limit