1 files changed, 3 insertions, 2 deletions
diff --git a/synapse/handlers/stats.py b/synapse/handlers/stats.py
index 2f7c108181..8e1bf8b5d5 100644
--- a/synapse/handlers/stats.py
+++ b/synapse/handlers/stats.py
@@ -66,12 +66,13 @@ class StatsHandler(StateDeltasHandler):
@defer.inlineCallbacks
def process():
+ yield lock.acquire()
try:
yield self._unsafe_process()
finally:
- lock.release()
+ yield lock.release()
- if lock.acquire(blocking=False):
+ if not lock.locked:
# we only want to run this process one-at-a-time,
# and also, if the initial background updater wants us to keep out,
# we should respect that.
|