summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-05-16 14:07:08 +0100
committerErik Johnston <erik@matrix.org>2017-05-16 15:59:37 +0100
commitf2a5b6dbfd0f21919a36f779026e041900b998a9 (patch)
tree4de2f21de5d74d99d5875cf87ffd09000647da69
parentMerge pull request #2224 from matrix-org/erikj/prefill_state (diff)
downloadsynapse-f2a5b6dbfd0f21919a36f779026e041900b998a9.tar.xz
Speed up get_domain_from_id
-rw-r--r--synapse/types.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/types.py b/synapse/types.py
index c87ed813b9..445bdcb4d7 100644
--- a/synapse/types.py
+++ b/synapse/types.py
@@ -56,10 +56,10 @@ def create_requester(user_id, access_token_id=None, is_guest=False,
 
 
 def get_domain_from_id(string):
-    try:
-        return string.split(":", 1)[1]
-    except IndexError:
+    idx = string.find(":")
+    if idx == -1:
         raise SynapseError(400, "Invalid ID: %r" % (string,))
+    return string[idx + 1:]
 
 
 class DomainSpecificString(