summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-08-26 10:47:00 +0100
committerErik Johnston <erik@matrix.org>2016-08-26 10:47:00 +0100
commit25414b44a2edbf7cc66e46968e81b56ae32f2887 (patch)
treec8070e7ac625a751f74a635125763f76469472ea /synapse
parentFix tests (diff)
downloadsynapse-25414b44a2edbf7cc66e46968e81b56ae32f2887.tar.xz
Add measure on check_host_in_room
Diffstat (limited to '')
-rw-r--r--synapse/api/auth.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py
index 23a928de16..597631a88f 100644
--- a/synapse/api/auth.py
+++ b/synapse/api/auth.py
@@ -278,20 +278,21 @@ class Auth(object):
 
     @defer.inlineCallbacks
     def check_host_in_room(self, room_id, host):
-        curr_state_id = yield self.state.get_current_state_ids(room_id)
+        with Measure(self.clock, "check_host_in_room"):
+            curr_state_id = yield self.state.get_current_state_ids(room_id)
 
-        for (etype, state_key), event_id in curr_state_id.items():
-            if etype == EventTypes.Member:
-                try:
-                    if get_domain_from_id(state_key) != host:
+            for (etype, state_key), event_id in curr_state_id.items():
+                if etype == EventTypes.Member:
+                    try:
+                        if get_domain_from_id(state_key) != host:
+                            continue
+                    except:
+                        logger.warn("state_key not user_id: %s", state_key)
                         continue
-                except:
-                    logger.warn("state_key not user_id: %s", state_key)
-                    continue
 
-                event = yield self.store.get_event(event_id, allow_none=True)
-                if event and event.content["membership"] == Membership.JOIN:
-                    defer.returnValue(True)
+                    event = yield self.store.get_event(event_id, allow_none=True)
+                    if event and event.content["membership"] == Membership.JOIN:
+                        defer.returnValue(True)
 
         defer.returnValue(False)