Skip to content

Commit

Permalink
Merge pull request #223 from softeerbootcamp4th/feature/#203-rush-eve…
Browse files Browse the repository at this point in the history
…nt-apply-stress-test

fix: redis 코드는 냅두고 기존 코드 다시 적용
  • Loading branch information
k000927 authored Aug 22, 2024
2 parents 5c231e9 + aae1d2c commit 7f8522c
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ public void apply(BaseUser user, int optionId) {
RushEvent rushEvent = RepositoryErrorHandler.findByIdOrElseThrow(rushEventRepository, todayEventId, CustomErrorCode.NO_RUSH_EVENT);

// redis incr 호출
rushEventRedisService.incrementOptionCount(todayEventId, optionId);
// rushEventRedisService.incrementOptionCount(todayEventId, optionId);


// 새로운 RushParticipants 를 생성하여 DB 에 저장
RushParticipants rushParticipants = new RushParticipants(user, rushEvent, optionId);
Expand All @@ -98,12 +99,12 @@ public RushEventRateResponseDto getRushEventRate(BaseUser user) {
Long todayEventId = eventCacheService.getTodayEvent(today).rushEventId();
Optional<Integer> optionId = rushParticipantsRepository.getOptionIdByUserId(user.getPhoneNumber());

// long leftOptionCount = rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(todayEventId, 1);
// long rightOptionCount = rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(todayEventId, 2);
long leftOptionCount = rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(todayEventId, 1);
long rightOptionCount = rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(todayEventId, 2);

// redis 에 캐싱 값 가져옴
long leftOptionCount = rushEventRedisService.getOptionCount(todayEventId, 1);
long rightOptionCount = rushEventRedisService.getOptionCount(todayEventId, 2);
// long leftOptionCount = rushEventRedisService.getOptionCount(todayEventId, 1);
// long rightOptionCount = rushEventRedisService.getOptionCount(todayEventId, 2);

return new RushEventRateResponseDto(
optionId.orElseThrow(() -> new CustomException("유저가 응모한 선택지가 존재하지 않습니다.", CustomErrorCode.USER_NOT_FOUND)),
Expand Down

0 comments on commit 7f8522c

Please sign in to comment.