fix and improve ProjectionSnapshotRepositoryInRedis

This commit is contained in:
2025-04-14 23:40:02 +02:00
parent 22792a0427
commit 442379dc49
18 changed files with 283 additions and 151 deletions
@@ -7,4 +7,6 @@ interface GameStateRepository {
fun getLast(gameId: GameId): GameState
fun getUntil(event: GameEvent): GameState
fun count(gameId: GameId): Int
}
@@ -33,11 +33,11 @@ class ReactionListener(
}
}
} else {
logger.error { "${this::class.java.simpleName} is already init for this bus" }
logger.error { "${this::class.simpleName} is already init for this bus" }
}
}
private fun sendStartGameEvent(state: GameState) {
private suspend fun sendStartGameEvent(state: GameState) {
if (state.isReady && !state.isStarted) {
val reactionEvent =
eventHandler.handle(state.aggregateId) {
@@ -54,7 +54,7 @@ class ReactionListener(
}
}
private fun sendWinnerEvent(state: GameState) {
private suspend fun sendWinnerEvent(state: GameState) {
val winner = state.playerHasNoCardLeft().firstOrNull()
if (winner != null) {
val reactionEvent =