summary refs log tree commit diff
path: root/synapse/push/emailpusher.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-08-13 14:08:29 +0100
committerGitHub <noreply@github.com>2019-08-13 14:08:29 +0100
commitaf187805b35bb3bf92a45e9e519610bc06f084dc (patch)
tree78e97a8b18b76083c2d79ef8b7c333f7a9ca70b2 /synapse/push/emailpusher.py
parentDon't load the media repo when configured to use an external media repo (#5754) (diff)
parentRemove redundant return (diff)
downloadsynapse-af187805b35bb3bf92a45e9e519610bc06f084dc.tar.xz
Merge pull request #5809 from matrix-org/erikj/handle_pusher_stop
Handle pusher being deleted during processing.
Diffstat (limited to 'synapse/push/emailpusher.py')
-rw-r--r--synapse/push/emailpusher.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/synapse/push/emailpusher.py b/synapse/push/emailpusher.py
index 424ffa8b68..42e5b0c0a5 100644
--- a/synapse/push/emailpusher.py
+++ b/synapse/push/emailpusher.py
@@ -234,13 +234,19 @@ class EmailPusher(object):
             return
 
         self.last_stream_ordering = last_stream_ordering
-        yield self.store.update_pusher_last_stream_ordering_and_success(
-            self.app_id,
-            self.email,
-            self.user_id,
-            last_stream_ordering,
-            self.clock.time_msec(),
+        pusher_still_exists = (
+            yield self.store.update_pusher_last_stream_ordering_and_success(
+                self.app_id,
+                self.email,
+                self.user_id,
+                last_stream_ordering,
+                self.clock.time_msec(),
+            )
         )
+        if not pusher_still_exists:
+            # The pusher has been deleted while we were processing, so
+            # lets just stop and return.
+            self.on_stop()
 
     def seconds_until(self, ts_msec):
         secs = (ts_msec - self.clock.time_msec()) / 1000