summary refs log tree commit diff
path: root/synapse/appservice
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-08-17 14:52:26 +0100
committerErik Johnston <erik@matrix.org>2016-08-17 14:52:26 +0100
commitb9e888858ce6b0c3e4ec75c7b410b884a61fd4cf (patch)
treeaeec36462931159de5fc42e77a5e87696a63cd91 /synapse/appservice
parentMerge pull request #1019 from matrix-org/erikj/appservice_clean (diff)
downloadsynapse-b9e888858ce6b0c3e4ec75c7b410b884a61fd4cf.tar.xz
Move Measure block inside loop
Diffstat (limited to 'synapse/appservice')
-rw-r--r--synapse/appservice/scheduler.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/synapse/appservice/scheduler.py b/synapse/appservice/scheduler.py
index f130d4367d..d46d2fead2 100644
--- a/synapse/appservice/scheduler.py
+++ b/synapse/appservice/scheduler.py
@@ -113,20 +113,20 @@ class _ServiceQueuer(object):
         if service.id in self.requests_in_flight:
             return
 
-        with Measure(self.clock, "_ServiceQueuer._send_request"):
-            self.requests_in_flight.add(service.id)
-            try:
-                while True:
-                    events = self.queued_events.pop(service.id, [])
-                    if not events:
-                        return
+        self.requests_in_flight.add(service.id)
+        try:
+            while True:
+                events = self.queued_events.pop(service.id, [])
+                if not events:
+                    return
 
+                with Measure(self.clock, "_ServiceQueuer._send_request"):
                     try:
                         yield self.txn_ctrl.send(service, events)
                     except:
                         logger.exception("AS request failed")
-            finally:
-                self.requests_in_flight.discard(service.id)
+        finally:
+            self.requests_in_flight.discard(service.id)
 
 
 class _TransactionController(object):