diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2020-02-26 12:28:51 +0000 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2020-02-26 12:28:51 +0000 |
commit | f822f3baabda89dd242b6cb2277147fa13609a25 (patch) | |
tree | 37d90a5029e3401b72957fe7b911fbe4c831dc1d /synapse | |
parent | Log responder we are using. (#6139) (diff) | |
parent | Merge pull request #6161 from matrix-org/erikj/dont_regen_user_id_on_failure (diff) | |
download | synapse-f822f3baabda89dd242b6cb2277147fa13609a25.tar.xz |
Merge pull request #6161 from matrix-org/erikj/dont_regen_user_id_on_failure
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/handlers/register.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py index 983c8f1bff..cab0e33a92 100644 --- a/synapse/handlers/register.py +++ b/synapse/handlers/register.py @@ -225,10 +225,9 @@ class RegistrationHandler(BaseHandler): else: # autogen a sequential user ID - 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) @@ -251,7 +250,6 @@ class RegistrationHandler(BaseHandler): # if user id is taken, just generate another user = None user_id = None - attempts += 1 if not self.hs.config.user_consent_at_registration: yield self._auto_join_rooms(user_id) @@ -452,10 +450,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() ) |