Skip to content

Commit

Permalink
mongodb concurrency issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonpoo committed Oct 30, 2024
1 parent bdd356b commit 498727e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public interface UserService {

Mono<User> addNewConnectionAndReturnUser(String userId, AuthUser authUser);

Mono<User> saveUser(User user);

Mono<Void> deleteProfilePhoto(User visitor);

Mono<Boolean> updatePassword(String userId, String oldPassword, String newPassword);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ public Mono<User> addNewConnectionAndReturnUser(String userId, AuthUser authUser
.flatMap(repository::save);
}

@Override
public Mono<User> saveUser(User user) {
return repository.save(user);
}

@Override
public Mono<Void> deleteProfilePhoto(User visitor) {
String userAvatar = visitor.getAvatar();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public Mono<User> updateOrCreateUser(AuthUser authUser, boolean linkExistingUser
if (findByAuthUserFirst.userExist()) {
User user = findByAuthUserFirst.user();
updateConnection(authUser, user);
return userService.update(user.getId(), user);
return userService.saveUser(user);
}

//If the user connection is not found with login id, but the user is
Expand Down

0 comments on commit 498727e

Please sign in to comment.