Skip to content

Commit 1dac317

Browse files
committed
Correctly set lastKill in Server
1 parent bc014a6 commit 1dac317

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

server/src/main/kotlin/Server.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,20 @@ private fun KtorRoute.websocketHandler() {
8989
val kill = Kill(Clock.System.now(), name, ipHash)
9090
val timeSinceLastKill = Clock.System.now() - (lastKill ?: Instant.DISTANT_PAST)
9191
if (timeSinceLastKill >= 10.seconds) {
92+
lastKill = Clock.System.now()
9293
writeStats(
9394
stats.copy(
9495
stats.kills + kill,
9596
count = stats.count + 1
9697
)
9798
)
99+
100+
sessions.forEach {
101+
it.send(UpdateKillCounterEvent(stats.count, kill))
102+
}
98103
} else {
99104
LOG.debug { "Ignoring kill, last kill was $timeSinceLastKill ago" }
100105
}
101-
sessions.forEach {
102-
it.send(UpdateKillCounterEvent(stats.count, kill))
103-
}
104106
}
105107
}
106108
}

0 commit comments

Comments
 (0)