Skip to content

Commit

Permalink
Merge pull request #94 from SWM-M3PRO/feature/M3-410-fixSimultaneousl…
Browse files Browse the repository at this point in the history
…yProblem

M3-410 픽셀 차지시 클러스터링에서  동시성 문제
  • Loading branch information
koomin1227 authored Oct 19, 2024
2 parents f9769e4 + d159527 commit b886056
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
import com.m3pro.groundflip.domain.entity.Announcement;

public interface AnnouncementRepository extends JpaRepository<Announcement, Long> {
@Query("SELECT a FROM Announcement a WHERE a.id > :cursor ORDER BY a.id ASC LIMIT :size")
@Query("SELECT a FROM Announcement a WHERE a.id < :cursor ORDER BY a.id DESC LIMIT :size")
List<Announcement> findAllAnnouncement(@Param("cursor") Long cursor, @Param("size") int size);
}
4 changes: 2 additions & 2 deletions src/main/java/com/m3pro/groundflip/service/PixelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private UserRegionCount createUserRegionCount(Region region, Long userId) {
.region(region)
.user(userRepository.getReferenceById(userId))
.build();
return userRegionCountRepository.save(userRegionCount);
return userRegionCountRepository.saveAndFlush(userRegionCount);
}

private void updateCommunityCurrentPixelCount(Pixel targetPixel, Long communityId) {
Expand Down Expand Up @@ -237,7 +237,7 @@ private CompetitionCount createCompetitionCount(Region region, int week, int yea
.week(week)
.year(year)
.build();
return competitionCountRepository.save(competitionCount);
return competitionCountRepository.saveAndFlush(competitionCount);
}

private void updatePixelOwnerCommunity(Pixel targetPixel, Long occupyingCommunityId) {
Expand Down

0 comments on commit b886056

Please sign in to comment.