Skip to content

Conversation

@nyeroni
Copy link
Member

@nyeroni nyeroni commented Apr 9, 2025

PR 타입

  • 기능 추가
  • 기능 삭제
  • 버그 수정
  • 의존성, 환경 변수, 빌드 관련 코드 업데이트

반영 브랜치

feature/post-like -> develop

변경 사항

  • PostRepository: findByIdWithPessimisticLock 메서드 추가 (@lock(LockModeType.PESSIMISTIC_WRITE) 적용)
  • PostService: 좋아요 추가 로직에 동시성 제어 도입
  • PostService: 좋아요 수 기준 변경 (postLikeRepository.countByPostId)
  • 불필요한 likeCount 필드 증가 로직 제거

추가 설명

  • 다수 사용자의 동시에 좋아요 클릭 시 HOT 게시판 진입 조건이 무시되는 문제를 해결하기 위해 Pessimistic Lock을 적용했습니다.
  • 좋아요 수는 이제 Post 엔티티 내 필드가 아닌, PostLike 테이블 카운트 기반으로 처리되며, 모든 관련 작업은 트랜잭션 내에서 일괄 처리됩니다.

@nyeroni nyeroni added the 🐛bug Something isn't working label Apr 9, 2025
@nyeroni nyeroni self-assigned this Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants