Skip to content

Commit

Permalink
chore(account): gracefully handle race in sync
Browse files Browse the repository at this point in the history
  • Loading branch information
pennersr committed Dec 13, 2021
1 parent 201c342 commit ad25887
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions allauth/account/utils.py
Expand Up @@ -379,8 +379,9 @@ def sync_user_email_addresses(user):
):
# Bail out
return
EmailAddress.objects.create(
user=user, email=email, primary=False, verified=False
# get_or_create() to gracefully handle races
EmailAddress.objects.get_or_create(
user=user, email=email, defaults={"primary": False, "verified": False}
)


Expand Down

0 comments on commit ad25887

Please sign in to comment.