Skip to content

feat: add player hearbeat processing#21

Open
lusu007 wants to merge 3 commits intomainfrom
feat/player-heartbeat
Open

feat: add player hearbeat processing#21
lusu007 wants to merge 3 commits intomainfrom
feat/player-heartbeat

Conversation

@lusu007
Copy link
Contributor

@lusu007 lusu007 commented Jan 25, 2026

Pull Request

Description

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • ♻️ Refactoring
  • 📚 Documentation
  • 🔧 Chore

Related Issues

None

Testing

  • Unit tests pass
  • Manual testing completed
  • New tests added for new functionality

Checklist

  • I have performed a self-review of my own code
  • Tests have been added/updated and pass (if needed)
  • Documentation has been updated (if needed)

@lusu007 lusu007 requested a review from ItsKev January 25, 2026 22:25
@lusu007 lusu007 self-assigned this Jan 25, 2026
Copilot AI review requested due to automatic review settings January 25, 2026 22:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds player heartbeat processing functionality to track active player sessions. However, there is a typo in the PR title: "hearbeat" should be "heartbeat".

Changes:

  • Added last_seen_at timestamp tracking to player sessions with database migration and index
  • Implemented batch heartbeat endpoint to update session activity timestamps
  • Added scheduled cleanup job to remove stale sessions based on configurable TTL
  • Enhanced login flow to handle stale session detection and removal

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/main/resources/db/migration/V1__create_player_sessions.sql Added last_seen_at column with default value and index for efficient stale session queries
src/main/kotlin/gg/grounds/domain/PlayerSession.kt Extended domain model to include lastSeenAt timestamp
src/main/kotlin/gg/grounds/persistence/PlayerSessionRepository.kt Added touchSessions for batch updates and deleteStaleSessions for cleanup; updated existing queries
src/main/kotlin/gg/grounds/api/PlayerPresenceGrpcService.kt Implemented heartbeat batch handler; enhanced login to detect and remove stale sessions
src/main/kotlin/gg/grounds/presence/PlayerSessionCleanup.kt New scheduled task to automatically clean up stale sessions at configured intervals
src/main/resources/application.properties Added session TTL and cleanup interval configuration; set global log level to DEBUG
src/test/resources/application.properties Disabled scheduler in tests to prevent interference
src/test/kotlin/gg/grounds/api/PlayerPresenceGrpcServiceTest.kt Added comprehensive tests for heartbeat batch and stale session handling
build.gradle.kts Added scheduler dependency; updated to SNAPSHOT version of gRPC contracts library

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lusu007 lusu007 linked an issue Jan 26, 2026 that may be closed by this pull request
@lusu007
Copy link
Contributor Author

lusu007 commented Jan 26, 2026

Please merge groundsgg/library-grpc-contracts#33 first.
This change depends on the updated gRPC contract release; once the contracts are released, the referenced proto version must be bumped accordingly.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Player Sync (Single Active Session)

1 participant

Comments