summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-10-03 17:33:54 +0100
committerErik Johnston <erik@matrix.org>2019-10-03 17:33:54 +0100
commit693156aaf4579f48ad265f42f90b1bd73feda129 (patch)
tree8a5804469730ba9864b8ac589ef7c4aeac20e4fc
parentMerge branch 'master' into develop (diff)
downloadsynapse-693156aaf4579f48ad265f42f90b1bd73feda129.tar.xz
Don't regenerate numeric user ID if registration fails.
This causes huge amounts of DB IO if registrations start to fail e.g.
because the DB is struggling with IO.
-rw-r--r--synapse/handlers/register.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py
index 06bd03b77c..6dd7ef3745 100644
--- a/synapse/handlers/register.py
+++ b/synapse/handlers/register.py
@@ -220,7 +220,7 @@ class RegistrationHandler(BaseHandler):
             attempts = 0
             user = None
             while not user:
-                localpart = yield self._generate_user_id(attempts > 0)
+                localpart = yield self._generate_user_id()
                 user = UserID(localpart, self.hs.hostname)
                 user_id = user.to_string()
                 yield self.check_user_id_not_appservice_exclusive(user_id)
@@ -379,10 +379,10 @@ class RegistrationHandler(BaseHandler):
                 )
 
     @defer.inlineCallbacks
-    def _generate_user_id(self, reseed=False):
-        if reseed or self._next_generated_user_id is None:
+    def _generate_user_id(self):
+        if self._next_generated_user_id is None:
             with (yield self._generate_user_id_linearizer.queue(())):
-                if reseed or self._next_generated_user_id is None:
+                if self._next_generated_user_id is None:
                     self._next_generated_user_id = (
                         yield self.store.find_next_generated_user_id_localpart()
                     )