fix: temp workaround on race condition

This commit is contained in:
Derrick Hammer 2023-08-04 12:53:13 -04:00
parent e09e51bb52
commit e2db880038
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 0 deletions

View File

@ -62,6 +62,9 @@ func generateAndSaveLoginToken(accountID uint, maxAge time.Duration) (string, er
}
if err := db.Get().Create(&session).Error; err != nil {
if strings.Contains(err.Error(), "Duplicate entry") {
return token, nil
}
logger.Get().Error(ErrFailedSaveToken.Error(), zap.Uint("account_id", accountID), zap.Duration("max_age", maxAge))
return "", ErrFailedSaveToken
}