summary refs log tree commit diff
path: root/synapse/push/emailpusher.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-06-17 14:10:28 +0100
committerErik Johnston <erik@matrix.org>2019-06-17 14:10:28 +0100
commitc08e4dbadc36d5547d4ff14ec4d985823666fb80 (patch)
tree3a79f31f2785db645e5f28088c63e8e06c01c0ca /synapse/push/emailpusher.py
parentMerge branch 'master' of github.com:matrix-org/synapse into matrix-org-hotfixes (diff)
parentMerge pull request #5385 from matrix-org/erikj/reduce_http_exceptions (diff)
downloadsynapse-c08e4dbadc36d5547d4ff14ec4d985823666fb80.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into matrix-org-hotfixes
Diffstat (limited to 'synapse/push/emailpusher.py')
-rw-r--r--synapse/push/emailpusher.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/synapse/push/emailpusher.py b/synapse/push/emailpusher.py

index e8ee67401f..c89a8438a9 100644 --- a/synapse/push/emailpusher.py +++ b/synapse/push/emailpusher.py
@@ -114,6 +114,21 @@ class EmailPusher(object): run_as_background_process("emailpush.process", self._process) + def _pause_processing(self): + """Used by tests to temporarily pause processing of events. + + Asserts that its not currently processing. + """ + assert not self._is_processing + self._is_processing = True + + def _resume_processing(self): + """Used by tests to resume processing of events after pausing. + """ + assert self._is_processing + self._is_processing = False + self._start_processing() + @defer.inlineCallbacks def _process(self): # we should never get here if we are already processing @@ -215,6 +230,10 @@ class EmailPusher(object): @defer.inlineCallbacks def save_last_stream_ordering_and_success(self, last_stream_ordering): + if last_stream_ordering is None: + # This happens if we haven't yet processed anything + 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,