summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2016-04-07 17:31:08 +0100
committerDavid Baker <dave@matrix.org>2016-04-07 17:31:08 +0100
commit15e0f1696f2556f72b65f14466df51e9a9f00c4b (patch)
tree9cf940228451535e3d21e59b582163bda2917c43 /synapse
parentindenting (diff)
downloadsynapse-15e0f1696f2556f72b65f14466df51e9a9f00c4b.tar.xz
Wrap process in a flag so we don't process whist already processing.
Diffstat (limited to 'synapse')
-rw-r--r--synapse/push/httppusher.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/synapse/push/httppusher.py b/synapse/push/httppusher.py
index ea45b603c6..a0d0234e2e 100644
--- a/synapse/push/httppusher.py
+++ b/synapse/push/httppusher.py
@@ -48,6 +48,7 @@ class HttpPusher(object):
         self.backoff_delay = HttpPusher.INITIAL_BACKOFF_SEC
         self.failing_since = pusherdict['failing_since']
         self.timed_call = None
+        self.processing = False
 
         # This is the highest stream ordering we know it's safe to process.
         # When new events arrive, we'll be given a window of new events: we
@@ -109,6 +110,14 @@ class HttpPusher(object):
 
     @defer.inlineCallbacks
     def _process(self):
+        try:
+            self.processing = True
+            yield self._unsafe_process()
+        finally:
+            self.processing = False
+
+    @defer.inlineCallbacks
+    def _unsafe_process(self):
         unprocessed = yield self.store.get_unread_push_actions_for_user_in_range(
             self.user_id, self.last_stream_ordering, self.max_stream_ordering
         )