Skip to content

Commit

Permalink
Shift session cleanup @transactional to repository
Browse files Browse the repository at this point in the history
Fixes timeouts and inconsistent state when large amounts of session stack up.
  • Loading branch information
Brutus5000 committed Oct 20, 2024
1 parent fa137ef commit cb53412
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import jakarta.inject.Singleton
import jakarta.persistence.Entity
import jakarta.persistence.Id
import jakarta.persistence.Table
import jakarta.transaction.Transactional
import org.slf4j.LoggerFactory
import java.time.Instant
import java.util.UUID
Expand All @@ -23,6 +24,7 @@ data class IceSessionEntity(
private val LOG = LoggerFactory.getLogger(IceSessionRepository::class.java)

@Singleton
@Transactional
class IceSessionRepository : PanacheRepository<IceSessionEntity> {
fun existsByGameId(gameId: Long) = count("gameId = ?1", gameId) != 0L

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ class SessionService(
}
}

@Transactional
@Scheduled(every = "10m")
fun cleanUpSessions() {
LOG.info("Cleaning up outdated sessions")
Expand Down

0 comments on commit cb53412

Please sign in to comment.