Skip to content

Commit

Permalink
Merge pull request #95 from SWM-M3PRO/develop
Browse files Browse the repository at this point in the history
클러스터링 집계 동시성 문제 업데이트
  • Loading branch information
koomin1227 authored Oct 19, 2024
2 parents bb29fdc + b886056 commit 443c71a
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 443c71a

Please sign in to comment.