refactor: update timer record calls to use Runnable type
Build & Test (NowChessSystems) TeamCity build failed
Build & Test (NowChessSystems) TeamCity build failed
This commit is contained in:
+1
-3
@@ -42,9 +42,7 @@ class CacheEvictionManager:
|
||||
redisPrefix = prefix
|
||||
|
||||
def evictStaleGames: Unit =
|
||||
meterRegistry.timer("nowchess.coordinator.cache.eviction.duration").record { () =>
|
||||
runEviction()
|
||||
}
|
||||
meterRegistry.timer("nowchess.coordinator.cache.eviction.duration").record((() => runEviction()): Runnable)
|
||||
|
||||
private def runEviction(): Unit =
|
||||
log.info("Starting cache eviction scan")
|
||||
|
||||
@@ -369,7 +369,7 @@ class GameEngine(
|
||||
case GameResult.Draw(_) => "draw.insufficient"
|
||||
case _ => "timeout"
|
||||
Option(gamesCompletedCounter(tag)).foreach(_.increment())
|
||||
activeGamesCount.decrementAndGet()
|
||||
GameEngine.activeGamesCount.decrementAndGet()
|
||||
notifyObservers(TimeFlagEvent(currentContext, flagged))
|
||||
|
||||
private def scheduleExpiryCheck(cs: ClockState): Unit =
|
||||
@@ -406,7 +406,7 @@ class GameEngine(
|
||||
|
||||
private def executeMove(move: Move): Unit =
|
||||
Option(movesDurationTimer) match
|
||||
case Some(timer) => timer.record(() => executeMoveBody(move))
|
||||
case Some(timer) => timer.record((() => executeMoveBody(move)): Runnable)
|
||||
case None => executeMoveBody(move)
|
||||
Option(movesProcessedCounter).foreach(_.increment())
|
||||
|
||||
|
||||
+2
-2
@@ -88,8 +88,8 @@ class OfficialBotService:
|
||||
botController.getBot(botName).orElse(botController.getBot(level.toString.toLowerCase)).foreach { bot =>
|
||||
FenParser.parseFen(fen).toOption.foreach { context =>
|
||||
val timer = meterRegistry.timer("nowchess.bot.move.duration", "bot", botName)
|
||||
val moveOpt = timer.recordCallable(() => bot(context))
|
||||
moveOpt.flatten.foreach { move =>
|
||||
val moveOpt = timer.recordCallable[Option[Move]](() => bot(context))
|
||||
moveOpt.foreach { move =>
|
||||
meterRegistry.counter("nowchess.bot.moves.computed", "bot", botName).increment()
|
||||
val uci = toUci(move)
|
||||
val c2sTopic = s"${redisConfig.prefix}:game:$gameId:c2s"
|
||||
|
||||
@@ -33,7 +33,7 @@ class GameWritebackService:
|
||||
|
||||
@Transactional
|
||||
def writeBack(event: GameWritebackEventDto): Unit =
|
||||
writebackTimer.record(() => doWriteBack(event))
|
||||
writebackTimer.record((() => doWriteBack(event)): Runnable)
|
||||
|
||||
private def doWriteBack(event: GameWritebackEventDto): Unit =
|
||||
repository.findByGameId(event.gameId) match
|
||||
|
||||
Reference in New Issue
Block a user