diff options
author | Erik Johnston <erik@matrix.org> | 2015-06-18 11:12:03 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-06-18 11:12:03 +0100 |
commit | 10a67f0d692b0b54a40514a5ec91d77133d1b1d2 (patch) | |
tree | 3f93a42cc96ebc8258b87d63c7d72ef3fd5f5973 | |
parent | Don't reuse name (diff) | |
download | synapse-github/erikj/notifier_debug.tar.xz |
Don't spuriously create new listeners github/erikj/notifier_debug erikj/notifier_debug
-rw-r--r-- | synapse/notifier.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/synapse/notifier.py b/synapse/notifier.py index 1a6a2c780c..76637b176d 100644 --- a/synapse/notifier.py +++ b/synapse/notifier.py @@ -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]) |