Conversation
Summary of ChangesHello @Hwanvely, 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
🧠 New Feature in Public Preview: You can now enable Memory 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 AssistThe 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
Customization To customize 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 Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. 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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
이번 PR은 피버타임의 일시정지/재개 로직을 개선하고, 이벤트 발생 시간을 동기화하여 정확성을 높인 점이 인상적입니다. 특히 FeverTime에 클라이언트 요청 시간 검증 로직을 추가하여 네트워크 지연이나 잠재적인 치팅을 방지한 점은 좋은 개선입니다. 또한, 피버 스트릭 횟수 제한을 두어 게임 밸런스를 조정한 부분도 잘 보았습니다. 전반적으로 게임 세션의 안정성과 신뢰도를 높이는 중요한 변경이라고 생각합니다. 한 가지, SnackgameService의 end 메소드에서 데이터베이스 조회를 더 효율적으로 할 수 있는 부분을 제안드렸으니 확인해보시면 좋겠습니다.
| // DB에서 세션 ID로만 조회하여 실제 ownerId 확인 | ||
| val sessionById = snackGameRepository.findById(sessionId) | ||
| if (sessionById.isPresent) { | ||
| val actualOwnerId = sessionById.get().ownerId | ||
| log.info("[세션 존재 확인] sessionId: $sessionId, actualOwnerId: $actualOwnerId, requestMemberId: $memberId, 일치여부: ${actualOwnerId == memberId}") | ||
| } else { | ||
| log.warn("[세션 없음] sessionId: $sessionId 가 DB에 존재하지 않음") | ||
| } | ||
|
|
||
| val game = snackGameRepository.getBy(memberId, sessionId) | ||
| log.info("[세션 조회 성공] sessionId: $sessionId, ownerId: ${game.ownerId}, score: ${game.score}") |
There was a problem hiding this comment.
현재 end 메소드에서 게임 세션을 조회하기 위해 데이터베이스에 두 번 접근하고 있습니다. 첫 번째는 로깅을 위해 findById(sessionId)를 호출하고, 두 번째는 실제 게임 객체를 가져오기 위해 getBy(memberId, sessionId)를 호출합니다. 이는 비효율적입니다.
findById(sessionId)로 한 번만 조회한 후, 세션 존재 여부와 소유자 일치 여부를 확인하고 로깅하는 방식으로 리팩토링하여 데이터베이스 접근을 한 번으로 줄일 수 있습니다. 이렇게 하면 성능을 개선하면서도 동일한 디버깅 정보를 얻을 수 있습니다.
| // DB에서 세션 ID로만 조회하여 실제 ownerId 확인 | |
| val sessionById = snackGameRepository.findById(sessionId) | |
| if (sessionById.isPresent) { | |
| val actualOwnerId = sessionById.get().ownerId | |
| log.info("[세션 존재 확인] sessionId: $sessionId, actualOwnerId: $actualOwnerId, requestMemberId: $memberId, 일치여부: ${actualOwnerId == memberId}") | |
| } else { | |
| log.warn("[세션 없음] sessionId: $sessionId 가 DB에 존재하지 않음") | |
| } | |
| val game = snackGameRepository.getBy(memberId, sessionId) | |
| log.info("[세션 조회 성공] sessionId: $sessionId, ownerId: ${game.ownerId}, score: ${game.score}") | |
| val game = snackGameRepository.findById(sessionId) | |
| .orElseThrow { | |
| log.warn("[세션 없음] sessionId: {} 가 DB에 존재하지 않음", sessionId) | |
| SessionNotFoundException() | |
| } | |
| log.info("[세션 소유자 확인] sessionId: {}, actualOwnerId: {}, requestMemberId: {}, 일치여부: {}", sessionId, game.ownerId, memberId, game.ownerId == memberId) | |
| if (game.ownerId != memberId) { | |
| throw SessionNotFoundException() | |
| } | |
| log.info("[세션 조회 성공] sessionId: {}, ownerId: {}, score: {}", sessionId, game.ownerId, game.score) |
No description provided.