mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-27 09:58:41 +00:00
Don't spuriously create new listeners
This commit is contained in:
parent
9bc36b7f31
commit
10a67f0d69
|
@ -350,14 +350,15 @@ class Notifier(object):
|
|||
while not result and not timed_out[0]:
|
||||
new_token = yield deferred
|
||||
|
||||
deferred = defer.Deferred()
|
||||
listener = _NotificationListener(deferred, timeout)
|
||||
listeners.append(listener)
|
||||
user_stream.listeners.add(listener)
|
||||
|
||||
result = yield callback(current_token, new_token)
|
||||
current_token = new_token
|
||||
|
||||
if not result:
|
||||
deferred = defer.Deferred()
|
||||
listener = _NotificationListener(deferred, timeout)
|
||||
listeners.append(listener)
|
||||
user_stream.listeners.add(listener)
|
||||
|
||||
if timer[0] is not None:
|
||||
try:
|
||||
self.clock.cancel_call_later(timer[0])
|
||||
|
|
Loading…
Reference in a new issue