summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-05-13 15:08:24 +0100
committerMark Haines <mark.haines@matrix.org>2015-05-13 15:08:24 +0100
commitdf6db5c8025e67c410a60994ac87eb39d842af30 (patch)
tree70ffc05f72d9901a7fb3379c2c635e078482b932 /synapse
parentDon't bother checking for updates if the stream token hasn't advanced for a user (diff)
downloadsynapse-df6db5c8025e67c410a60994ac87eb39d842af30.tar.xz
Don't bother checking for new events from a source if the stream token hasn't advanced for that source
Diffstat (limited to '')
-rw-r--r--synapse/notifier.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/notifier.py b/synapse/notifier.py
index 4d10c05038..d2fefea756 100644
--- a/synapse/notifier.py
+++ b/synapse/notifier.py
@@ -294,7 +294,7 @@ class Notifier(object):
             def _timeout_listener():
                 timed_out[0] = True
                 timer[0] = None
-                listener[0].notify(user_stream)
+                listener[0].notify(from_token)
 
             # We create multiple notification listeners so we have to manage
             # canceling the timeout ourselves.
@@ -329,11 +329,15 @@ class Notifier(object):
         limit = pagination_config.limit
 
         @defer.inlineCallbacks
-        def check_for_updates(start_token, end_token):
+        def check_for_updates(before_token, after_token):
             events = []
             end_token = from_token
             for name, source in self.event_sources.sources.items():
                 keyname = "%s_key" % name
+                before_id = getattr(before_token, keyname)
+                after_id = getattr(after_token, keyname)
+                if before_id == after_id:
+                    continue
                 stuff, new_key = yield source.get_new_events_for_user(
                     user, getattr(from_token, keyname), limit,
                 )