Skip to content

피버타임 일시정지 동기화 및 지연시간 문제 해결#232

Merged
Hwanvely merged 3 commits intodevfrom
fix/fever-time-latency
Jan 21, 2026
Merged

피버타임 일시정지 동기화 및 지연시간 문제 해결#232
Hwanvely merged 3 commits intodevfrom
fix/fever-time-latency

Conversation

@Hwanvely
Copy link
Collaborator

No description provided.

@Hwanvely Hwanvely self-assigned this Jan 21, 2026
@Hwanvely Hwanvely added the fix label Jan 21, 2026
@Hwanvely Hwanvely merged commit fee6688 into dev Jan 21, 2026
1 check passed
@gemini-code-assist
Copy link

Summary of Changes

Hello @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

  • 피버타임 일시정지/재개 동기화 개선: Session.kt 및 SessionState.kt의 pause()/resume() 메서드가 이제 LocalDateTime을 반환하며, SessionPauseEvent.kt 및 SessionResumeEvent.kt는 정확한 이벤트 발생 시각을 전달받도록 변경되었습니다.
  • 피버타임 지연시간 및 부정행위 방지: FeverTime.kt에 serverNow 파라미터가 추가되어 클라이언트가 제공하는 occurredAt 시각에 대한 서버 측 유효성 검증(최대 허용 과거/미래 시간)이 강화되었습니다. 또한, feverEndAt 검증 시 BUFFER_DURATION을 추가하여 네트워크 지연을 고려합니다.
  • 피버타임 배율 적용 횟수 제한: FeverTime.kt에 feverStreakCount와 MAX_FEVER_STREAKS가 도입되어 단일 피버타임 내에서 배율이 적용될 수 있는 최대 횟수를 제한하여 오용을 방지합니다. 관련 로직은 SnackgameBiz.kt, SnackgameBizV2.kt, Snackgame.kt에 적용되었습니다.
  • 세션 종료 시 로깅 강화: SnackgameService.kt에 세션 종료 시도 및 실제 소유자 ID 확인을 위한 상세 로깅이 추가되었습니다.
  • 코드 스타일 업데이트: .idea/codeStyles/Project.xml 파일의 import 레이아웃에 모듈 import 규칙이 추가되었습니다.
  • 불필요한 예외 클래스 제거: InvalidStreakTimeException.kt 파일이 삭제되었습니다.

🧠 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 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 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 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

  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.

Copy link

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

Choose a reason for hiding this comment

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

Code Review

이번 PR은 피버타임의 일시정지/재개 로직을 개선하고, 이벤트 발생 시간을 동기화하여 정확성을 높인 점이 인상적입니다. 특히 FeverTime에 클라이언트 요청 시간 검증 로직을 추가하여 네트워크 지연이나 잠재적인 치팅을 방지한 점은 좋은 개선입니다. 또한, 피버 스트릭 횟수 제한을 두어 게임 밸런스를 조정한 부분도 잘 보았습니다. 전반적으로 게임 세션의 안정성과 신뢰도를 높이는 중요한 변경이라고 생각합니다. 한 가지, SnackgameServiceend 메소드에서 데이터베이스 조회를 더 효율적으로 할 수 있는 부분을 제안드렸으니 확인해보시면 좋겠습니다.

Comment on lines +104 to +114
// 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}")

Choose a reason for hiding this comment

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

medium

현재 end 메소드에서 게임 세션을 조회하기 위해 데이터베이스에 두 번 접근하고 있습니다. 첫 번째는 로깅을 위해 findById(sessionId)를 호출하고, 두 번째는 실제 게임 객체를 가져오기 위해 getBy(memberId, sessionId)를 호출합니다. 이는 비효율적입니다.

findById(sessionId)로 한 번만 조회한 후, 세션 존재 여부와 소유자 일치 여부를 확인하고 로깅하는 방식으로 리팩토링하여 데이터베이스 접근을 한 번으로 줄일 수 있습니다. 이렇게 하면 성능을 개선하면서도 동일한 디버깅 정보를 얻을 수 있습니다.

Suggested change
// 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant