You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this code fragment is not thread safe (backends/init.py):
name, idx = username, 2
while True:
try:
name = fixer(name)
User.objects.get(username=name)
name = username + str(idx)
idx += 1
except User.DoesNotExist:
username = name
break
parallel processes or threads can generate same username and try to store same usernames. but the only one thread will write data, and others will raise IntegrityError.
using uuid instead of incrementing index is more safe. you can generate uuid and store it in base36.
greetz.
The text was updated successfully, but these errors were encountered:
this code fragment is not thread safe (backends/init.py):
parallel processes or threads can generate same username and try to store same usernames. but the only one thread will write data, and others will raise IntegrityError.
using uuid instead of incrementing index is more safe. you can generate uuid and store it in base36.
greetz.
The text was updated successfully, but these errors were encountered: