omab / python-social-auth

Social auth made simple
http://psa.matiasaguirre.net
BSD 3-Clause "New" or "Revised" License
2.83k stars 1.09k forks source link

Added exception handling for user creation race condition in Django #975

Closed carsongee closed 8 years ago

carsongee commented 8 years ago

We have an API client that sends a ton of requests in parallel after getting a token from a different oauth service. As a result, we have a race condition for local account creation. This patch handles that by seeing if there was IntegrityError as an indication that another fork created the user already and then trying to find the created user to return instead of making it.

omab commented 8 years ago

Thanks!