Fix: close all connections after each tests

This commit is contained in:
2025-04-14 23:40:19 +02:00
parent aa9dac74e8
commit 0aa13b9299
14 changed files with 307 additions and 226 deletions
@@ -48,6 +48,12 @@ private fun DefaultWebSocketServerSession.runWebSocket(
val currentPlayer = call.getPlayer()
val outgoingFrameChannel: SendChannel<Notification> = fromFrameChannel(outgoing)
withLoggingContext("currentPlayer" to currentPlayer.toString()) {
val notificationListener =
playerNotificationListener.startListening(
currentPlayer,
gameId,
) { outgoingFrameChannel.trySendBlocking(it) }
// TODO change GlobalScope
GlobalScope.launch {
commandHandler.handle(
@@ -56,12 +62,8 @@ private fun DefaultWebSocketServerSession.runWebSocket(
toObjectChannel(incoming),
outgoingFrameChannel,
)
notificationListener.close()
}
playerNotificationListener.startListening(
currentPlayer,
gameId,
) { outgoingFrameChannel.trySendBlocking(it) }
}
}