Fix race in presence handler where we evicted things from cache while handling a key therein

pull/10/head
Erik Johnston 2014-09-06 17:38:11 +01:00
parent 71fb748d70
commit de55ba218f
1 changed files with 3 additions and 2 deletions

View File

@ -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