fix: improve code readability in GameRecordRepository and GameRedisPublisher
Build & Test (NowChessSystems) TeamCity build failed
Build & Test (NowChessSystems) TeamCity build failed
This commit is contained in:
@@ -26,10 +26,11 @@ class GameRedisPublisher(
|
|||||||
) extends Observer:
|
) extends Observer:
|
||||||
|
|
||||||
def emitInitialWriteback(): Unit =
|
def emitInitialWriteback(): Unit =
|
||||||
try registry.get(gameId).foreach { entry =>
|
try
|
||||||
val dto = GameDtoMapper.toGameStateDto(entry, ioClient)
|
registry.get(gameId).foreach { entry =>
|
||||||
writebackEmit(objectMapper.writeValueAsString(buildWriteback(entry, dto)))
|
val dto = GameDtoMapper.toGameStateDto(entry, ioClient)
|
||||||
}
|
writebackEmit(objectMapper.writeValueAsString(buildWriteback(entry, dto)))
|
||||||
|
}
|
||||||
catch case ex: Exception => GameRedisPublisher.log.warnf(ex, "Failed to emit initial writeback for game %s", gameId)
|
catch case ex: Exception => GameRedisPublisher.log.warnf(ex, "Failed to emit initial writeback for game %s", gameId)
|
||||||
|
|
||||||
def onGameEvent(event: GameEvent): Unit =
|
def onGameEvent(event: GameEvent): Unit =
|
||||||
|
|||||||
+2
-1
@@ -42,7 +42,8 @@ class GameRecordRepository:
|
|||||||
.asScala
|
.asScala
|
||||||
.toList
|
.toList
|
||||||
.filter { g =>
|
.filter { g =>
|
||||||
val remaining = if g.clockActiveColor == "white" then g.whiteRemainingMs.longValue else g.blackRemainingMs.longValue
|
val remaining =
|
||||||
|
if g.clockActiveColor == "white" then g.whiteRemainingMs.longValue else g.blackRemainingMs.longValue
|
||||||
g.clockLastTickAt.longValue + remaining < nowMs
|
g.clockLastTickAt.longValue + remaining < nowMs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user