summary refs log tree commit diff
path: root/synapse/notifier.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-05-14 11:25:30 +0100
committerMark Haines <mark.haines@matrix.org>2015-05-14 11:25:30 +0100
commit3edd2d5c93ccbec46f101e65c6c7874a90bf0018 (patch)
tree0100c65cc9eae79cb35cce95d7131ca0df6e4a48 /synapse/notifier.py
parentFix metric counter (diff)
downloadsynapse-3edd2d5c93ccbec46f101e65c6c7874a90bf0018.tar.xz
Fix v2 sync, update the last_notified_ms only if there was an active listener
Diffstat (limited to '')
-rw-r--r--synapse/notifier.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/synapse/notifier.py b/synapse/notifier.py
index 1f7f0a143f..2de7dca8a5 100644
--- a/synapse/notifier.py
+++ b/synapse/notifier.py
@@ -81,14 +81,15 @@ class _NotifierUserStream(object):
         self.last_notified_ms = time_now_ms
 
     def notify(self, stream_key, stream_id, time_now_ms):
-        self.last_notified_ms = time_now_ms
         self.current_token = self.current_token.copy_and_replace(
             stream_key, stream_id
         )
-        listeners = self.listeners
-        self.listeners = set()
-        for listener in listeners:
-            listener.notify(self.current_token)
+        if self.listeners:
+            self.last_notified_ms = time_now_ms
+            listeners = self.listeners
+            self.listeners = set()
+            for listener in listeners:
+                listener.notify(self.current_token)
 
     def remove(self, notifier):
         """ Remove this listener from all the indexes in the Notifier