Skip to content

[Refactor] 좋아요 동시 요청 충돌 처리 공통화#179

Merged
pooreumjung merged 2 commits into
developfrom
refactor/#174-like-conflict-handler
Jun 2, 2026
Merged

[Refactor] 좋아요 동시 요청 충돌 처리 공통화#179
pooreumjung merged 2 commits into
developfrom
refactor/#174-like-conflict-handler

Conversation

@pooreumjung

Copy link
Copy Markdown
Member

🧾 요약

  • PostLikeService와 CourseLikeService에 중복된 동시 요청 충돌 처리 패턴을 LikeConflictHandler로 통합

🔗 이슈

✨ 변경 내용

  • LikeConflictHandler 유틸 추가 — 좋아요 생성 충돌을 멱등하게 처리하는 공통 헬퍼
  • PostLikeService, CourseLikeServiceDataIntegrityViolationException catch 블록을 LikeConflictHandler로 교체
  • LikeConflictHandlerTest 추가 — 정상 생성 / 충돌 감지 / 타 예외 전파 경로 검증

✅ 확인

  • 빌드 OK
  • 테스트 OK

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3f08d672-b683-4db9-bd6f-3bcc673f1b5b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/#174-like-conflict-handler

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

본 PR은 좋아요 기능에서 발생하는 동시성 이슈 처리 로직을 공통화하여 코드의 유지보수성을 높이고 중복을 제거하는 것을 목적으로 합니다. 기존에 서비스 레이어마다 개별적으로 구현되어 있던 예외 처리 패턴을 유틸리티 클래스로 분리함으로써, 향후 유사한 충돌 상황 발생 시 일관된 방식으로 대응할 수 있도록 개선하였습니다.

Highlights

  • LikeConflictHandler 유틸리티 추가: 좋아요 생성 시 발생하는 동시 요청 충돌(DataIntegrityViolationException)을 멱등하게 처리하기 위한 공통 유틸리티 클래스를 도입했습니다.
  • 서비스 로직 리팩토링: PostLikeService와 CourseLikeService에서 중복되던 예외 처리 로직을 LikeConflictHandler를 사용하도록 개선하여 코드 중복을 제거했습니다.
  • 테스트 코드 추가: LikeConflictHandler에 대한 단위 테스트를 추가하여 정상 동작, 충돌 감지, 예외 전파 시나리오를 검증했습니다.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@pooreumjung pooreumjung self-assigned this Jun 2, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a utility class LikeConflictHandler to handle concurrent creation conflicts and refactors PostLikeService and CourseLikeService to use it, reducing code duplication. Unit tests for the new handler are also added. The review feedback highlights critical issues regarding JPA's write-behind behavior, suggesting the use of saveAndFlush instead of save to ensure DataIntegrityViolationException is caught correctly during execution. Additionally, for PostLikeService, it is recommended to wrap the notification call in a try-catch block to prevent external side-effect failures from rolling back the main transaction.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@pooreumjung
pooreumjung merged commit f8858b7 into develop Jun 2, 2026
3 checks passed
@howooyeon
howooyeon deleted the refactor/#174-like-conflict-handler branch June 5, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[refactor] PostLikeService/CourseLikeService 동시 요청 처리 패턴 통합

1 participant