mirror of
https://github.com/element-hq/synapse
synced 2024-09-05 07:10:06 +00:00
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.
This commit is contained in:
parent
6018bec919
commit
693156aaf4
1 changed files with 4 additions and 4 deletions
|
@ -220,7 +220,7 @@ class RegistrationHandler(BaseHandler):
|
||||||
attempts = 0
|
attempts = 0
|
||||||
user = None
|
user = None
|
||||||
while not user:
|
while not user:
|
||||||
localpart = yield self._generate_user_id(attempts > 0)
|
localpart = yield self._generate_user_id()
|
||||||
user = UserID(localpart, self.hs.hostname)
|
user = UserID(localpart, self.hs.hostname)
|
||||||
user_id = user.to_string()
|
user_id = user.to_string()
|
||||||
yield self.check_user_id_not_appservice_exclusive(user_id)
|
yield self.check_user_id_not_appservice_exclusive(user_id)
|
||||||
|
@ -379,10 +379,10 @@ class RegistrationHandler(BaseHandler):
|
||||||
)
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _generate_user_id(self, reseed=False):
|
def _generate_user_id(self):
|
||||||
if reseed or self._next_generated_user_id is None:
|
if self._next_generated_user_id is None:
|
||||||
with (yield self._generate_user_id_linearizer.queue(())):
|
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 = (
|
self._next_generated_user_id = (
|
||||||
yield self.store.find_next_generated_user_id_localpart()
|
yield self.store.find_next_generated_user_id_localpart()
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue