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
We use the following pattern across the CRUD operations in the app layer:
...
users, err := u.ListUsers(f, &entity.ListOptions{})
if err != nil {
l.Error(err)
return nil, NewUserHandlerError("Internal error while creating user.")
}
if len(users.Elements) > 0 {
return nil, NewUserHandlerError(fmt.Sprintf("Duplicated entry %s for UniqueUserID.", user.UniqueUserID))
}
newUser, err := u.database.CreateUser(user)
...
Between the check if the user exists and the creation might occur a race condition. However, since we have a unique constraint on the database level, this will be prevented. In the future, we should avoid patterns these patterns by using transactions on the database layer.
The text was updated successfully, but these errors were encountered:
Task Description
We use the following pattern across the CRUD operations in the app layer:
Between the check if the user exists and the creation might occur a race condition. However, since we have a unique constraint on the database level, this will be prevented. In the future, we should avoid patterns these patterns by using transactions on the database layer.
The text was updated successfully, but these errors were encountered: