diff options
author | Richard van der Hoff <richard@matrix.org> | 2018-10-24 09:23:33 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2018-10-24 09:23:33 +0100 |
commit | e564306e315fc3dfd37e5fed495ae300fbb58c8a (patch) | |
tree | a61e0fe1eff2f555923f91e3064925d2c8e7c754 /synapse/push/httppusher.py | |
parent | Changelog (diff) | |
download | synapse-e564306e315fc3dfd37e5fed495ae300fbb58c8a.tar.xz |
sanity-check the is_processing flag
... and rename it, for even more sanity
Diffstat (limited to '')
-rw-r--r-- | synapse/push/httppusher.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/synapse/push/httppusher.py b/synapse/push/httppusher.py index 33034d44da..6bd703632d 100644 --- a/synapse/push/httppusher.py +++ b/synapse/push/httppusher.py @@ -60,7 +60,7 @@ class HttpPusher(object): self.backoff_delay = HttpPusher.INITIAL_BACKOFF_SEC self.failing_since = pusherdict['failing_since'] self.timed_call = None - self.processing = False + self._is_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 @@ -122,15 +122,18 @@ class HttpPusher(object): self.timed_call = None def _start_processing(self): - if self.processing: + if self._is_processing: return run_as_background_process("httppush.process", self._process) @defer.inlineCallbacks def _process(self): + # we should never get here if we are already processing + assert not self._is_processing + try: - self.processing = True + self._is_processing = True # if the max ordering changes while we're running _unsafe_process, # call it again, and so on until we've caught up. while True: @@ -142,7 +145,7 @@ class HttpPusher(object): if self.max_stream_ordering == starting_max_ordering: break finally: - self.processing = False + self._is_processing = False @defer.inlineCallbacks def _unsafe_process(self): |