Also perform paranoia checks in 'on_new_user_event'

This commit is contained in:
Erik Johnston 2015-04-08 13:40:20 +01:00
parent 65f5e4e3e4
commit 830d07db82

View File

@ -252,10 +252,24 @@ class Notifier(object):
listeners = set() listeners = set()
for user in users: for user in users:
listeners |= self.user_to_listeners.get(user, set()).copy() user_listeners = self.user_to_listeners.get(user, set())
# Remove any 'stale' listeners.
for l in user_listeners.copy():
if l.notified():
user_listeners.discard(l)
listeners |= user_listeners
for room in rooms: for room in rooms:
listeners |= self.room_to_listeners.get(room, set()).copy() room_listeners = self.room_to_listeners.get(room, set())
# Remove any 'stale' listeners.
for l in room_listeners.copy():
if l.notified():
room_listeners.discard(l)
listeners |= room_listeners
@defer.inlineCallbacks @defer.inlineCallbacks
def notify(listener): def notify(listener):