summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-10-18 10:52:47 +0100
committerErik Johnston <erik@matrix.org>2016-10-18 10:52:47 +0100
commitf0ca08828082eb1f0a5214b14099034ca53ecbab (patch)
tree27391a1da8f3c7f41c2f91c4e89123472ffa6642
parentUpdate changelog (diff)
downloadsynapse-f0ca08828082eb1f0a5214b14099034ca53ecbab.tar.xz
Reduce redundant database work in email pusher
Update the last stream ordering if the
`get_unread_push_actions_for_user_in_range_for_email` returns no new
push actions. This reduces the range that it needs to check next
iteration.
Diffstat (limited to '')
-rw-r--r--synapse/push/emailpusher.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/push/emailpusher.py b/synapse/push/emailpusher.py
index 6600c9cd55..2eb325c7c7 100644
--- a/synapse/push/emailpusher.py
+++ b/synapse/push/emailpusher.py
@@ -150,6 +150,10 @@ class EmailPusher(object):
 
         soonest_due_at = None
 
+        if not unprocessed:
+            yield self.save_last_stream_ordering_and_success(self.max_stream_ordering)
+            return
+
         for push_action in unprocessed:
             received_at = push_action['received_ts']
             if received_at is None: