diff options
-rw-r--r-- | sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt | 2 | ||||
-rw-r--r-- | sw-server/src/main/kotlin/org/luxons/sevenwonders/server/metrics/MetricsUtils.kt | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt index 56e94493..9fb1603a 100644 --- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt +++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt @@ -164,10 +164,10 @@ class LobbyController( bot.joinAndAutoPlay(lobby.id) } if (result == null) { + meterRegistry.counter("bot.timeout", lobby.playerCountsTags()).increment() val timeoutDuration = action.globalBotTimeoutMillis.milliseconds logger.error("Bot {} timed out after {}", action.botDisplayName, timeoutDuration) bot.disconnect() - meterRegistry.counter("bot.timeout", lobby.playerCountsTags()).increment() } } } diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/metrics/MetricsUtils.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/metrics/MetricsUtils.kt index 6b91428e..8d6570a2 100644 --- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/metrics/MetricsUtils.kt +++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/metrics/MetricsUtils.kt @@ -7,7 +7,7 @@ fun Lobby.playerCountsTags(): List<Tag> { val players = getPlayers() return listOf( Tag.of("nPlayers", players.size.toString()), - Tag.of("nHumans", players.filter { it.isHuman }.size.toString()), - Tag.of("nBots", players.filterNot { it.isHuman }.size.toString()), + Tag.of("nHumans", players.count { it.isHuman }.toString()), + Tag.of("nBots", players.count { !it.isHuman }.toString()), ) } |