Merge lp:~mhall119/django-openid-auth/quick-sequence-check into lp:~django-openid-auth/django-openid-auth/trunk
Status: | Merged |
---|---|
Approved by: | Anthony Lenton |
Approved revision: | 89 |
Merged at revision: | 88 |
Proposed branch: | lp:~mhall119/django-openid-auth/quick-sequence-check |
Merge into: | lp:~django-openid-auth/django-openid-auth/trunk |
Diff against target: |
119 lines (+96/-2) 2 files modified
django_openid_auth/auth.py (+4/-2) django_openid_auth/tests/test_views.py (+92/-0) |
To merge this branch: | bzr merge lp:~mhall119/django-openid-auth/quick-sequence-check |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Anthony Lenton | Approve | ||
Review via email: mp+77558@code.launchpad.net |
Commit message
skip ahead to a number that is likely available when generating a sequence number to append to a duplicate username
Description of the change
Overview
========
When you have multiple duplicates of username, the process of incrementing the appended number starting from i=0 can become quite time consuming and allows a race condition
Details
=======
Where there are many duplicates of a username, especially when using 'openiduser' for logins without a nickname, making a db call from 1 to n to find an available username causes a delay which allows the user to attempt the login again. Because we create the django.contrib.auth User first and then associate it with an openid, this duplicate request will create a duplicate User record but will then fail when assigning it to an openid.
This patch should drastically reduce the time it takes to identify an available username and closes the window where this race condition can occur.
Thanks for the fix Michael!