Ongeki: A rare bug that may cause errors in UpsertUser.
At icu.samnyan.aqua.api.controller.sega.game.ongeki.ApiOngekiPlayerDataController::insertCard, the code
Optional<UserCard> userCardOptional = userCardRepository.findByUserAndCardId(profile, cardId);
if (userCardOptional.isPresent()) {
...
}
GameCard card = gameCardRepository.findById(cardId.longValue()).orElseThrow();
is not thread safety. When two request with same profile and cardId arrive simultaneously, there will be two duplicate records. And this bug will cause the game failing to save.
Solution: Maybe @Lock annotation in Spring Data JPA will help, or an optimistic lock is needed.