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