summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-11-26 16:06:41 +0000
committerErik Johnston <erik@matrix.org>2019-11-26 16:06:41 +0000
commitf8f14ba466a18ee38827629b8e9ab2d5931e5713 (patch)
tree0e48a89740363a1fc36fd7a7b5a4d5c331ab2cad /synapse
parentNewsfile (diff)
downloadsynapse-f8f14ba466a18ee38827629b8e9ab2d5931e5713.tar.xz
Don't construct a set
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/data_stores/main/registration.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/synapse/storage/data_stores/main/registration.py b/synapse/storage/data_stores/main/registration.py
index c124bbb88b..0a3c1f0510 100644
--- a/synapse/storage/data_stores/main/registration.py
+++ b/synapse/storage/data_stores/main/registration.py
@@ -492,17 +492,14 @@ class RegistrationWorkerStore(SQLBaseStore):
 
             regex = re.compile(r"^@(\d+):")
 
-            found = set()
+            max_found = 0
 
             for (user_id,) in txn:
                 match = regex.search(user_id)
                 if match:
-                    found.add(int(match.group(1)))
+                    max_found = max(int(match.group(1)), max_found)
 
-            if not found:
-                return 1
-
-            return max(found) + 1
+            return max_found + 1
 
         return (
             (