feat(reflection): add native reflection configuration for tournament classes
Build & Test (NowChessSystems) TeamCity build finished
Build & Test (NowChessSystems) TeamCity build finished
fix(ws): improve WebSocket connection cleanup on close chore(stream): simplify group name generation in GameCreationStreamClient
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@ class GameCreationStreamClient:
|
|||||||
|
|
||||||
private val log = Logger.getLogger(classOf[GameCreationStreamClient])
|
private val log = Logger.getLogger(classOf[GameCreationStreamClient])
|
||||||
private val instanceId = UUID.randomUUID().toString
|
private val instanceId = UUID.randomUUID().toString
|
||||||
private val groupName = s"account-game-creation-$instanceId"
|
private val groupName = "account-game-creation"
|
||||||
private val consumerId = instanceId
|
private val consumerId = instanceId
|
||||||
private val maxStreamLen = 1000L
|
private val maxStreamLen = 1000L
|
||||||
private val timeout = Duration.ofSeconds(10)
|
private val timeout = Duration.ofSeconds(10)
|
||||||
|
|||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"reflection": [
|
||||||
|
{ "type": "scala.Tuple1[]" },
|
||||||
|
{ "type": "scala.Tuple2[]" },
|
||||||
|
{ "type": "scala.Tuple3[]" },
|
||||||
|
{ "type": "scala.Tuple4[]" },
|
||||||
|
{ "type": "scala.Tuple5[]" },
|
||||||
|
{ "type": "scala.Tuple6[]" },
|
||||||
|
{ "type": "scala.Tuple7[]" },
|
||||||
|
{ "type": "scala.Tuple8[]" },
|
||||||
|
{ "type": "scala.Tuple9[]" },
|
||||||
|
{ "type": "scala.Tuple10[]" },
|
||||||
|
{ "type": "scala.Tuple11[]" },
|
||||||
|
{ "type": "scala.Tuple12[]" },
|
||||||
|
{ "type": "scala.Tuple13[]" },
|
||||||
|
{ "type": "scala.Tuple14[]" },
|
||||||
|
{ "type": "scala.Tuple15[]" },
|
||||||
|
{ "type": "scala.Tuple16[]" },
|
||||||
|
{ "type": "scala.Tuple17[]" },
|
||||||
|
{ "type": "scala.Tuple18[]" },
|
||||||
|
{ "type": "scala.Tuple19[]" },
|
||||||
|
{ "type": "scala.Tuple20[]" },
|
||||||
|
{ "type": "scala.Tuple21[]" },
|
||||||
|
{ "type": "scala.Tuple22[]" },
|
||||||
|
{ "type": "com.fasterxml.jackson.module.scala.introspect.PropertyDescriptor[]" }
|
||||||
|
]
|
||||||
|
}
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
package de.nowchess.tournament.config
|
||||||
|
|
||||||
|
import de.nowchess.tournament.client.{CoreCreateGameRequest, CoreGameResponse, CorePlayerInfo, CoreTimeControl}
|
||||||
|
import de.nowchess.tournament.domain.{Tournament, TournamentPairing, TournamentParticipant}
|
||||||
|
import de.nowchess.tournament.dto.*
|
||||||
|
import de.nowchess.tournament.error.TournamentError
|
||||||
|
import io.quarkus.runtime.annotations.RegisterForReflection
|
||||||
|
|
||||||
|
@RegisterForReflection(
|
||||||
|
targets = Array(
|
||||||
|
classOf[Tournament],
|
||||||
|
classOf[TournamentPairing],
|
||||||
|
classOf[TournamentParticipant],
|
||||||
|
classOf[TournamentError],
|
||||||
|
classOf[BotRef],
|
||||||
|
classOf[Clock],
|
||||||
|
classOf[Variant],
|
||||||
|
classOf[CreateTournamentForm],
|
||||||
|
classOf[ResultDto],
|
||||||
|
classOf[Standing],
|
||||||
|
classOf[TournamentDto],
|
||||||
|
classOf[TournamentListDto],
|
||||||
|
classOf[PairingDto],
|
||||||
|
classOf[GameExportDto],
|
||||||
|
classOf[RoundPairingsDto],
|
||||||
|
classOf[ErrorDto],
|
||||||
|
classOf[OkDto],
|
||||||
|
classOf[CorePlayerInfo],
|
||||||
|
classOf[CoreTimeControl],
|
||||||
|
classOf[CoreCreateGameRequest],
|
||||||
|
classOf[CoreGameResponse],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
class NativeReflectionConfig
|
||||||
@@ -63,7 +63,12 @@ class UserWebSocketResource:
|
|||||||
@OnClose
|
@OnClose
|
||||||
def onClose(connection: WebSocketConnection): Unit =
|
def onClose(connection: WebSocketConnection): Unit =
|
||||||
log.infof("User WebSocket closed — connectionId=%s", connection.id())
|
log.infof("User WebSocket closed — connectionId=%s", connection.id())
|
||||||
connections.remove(connection.id())
|
val userIdOpt = Option(connections.remove(connection.id())).map(_._1)
|
||||||
|
userIdOpt.foreach { userId =>
|
||||||
|
Try(redis.stream(classOf[String]).xgroupDestroy(userStreamKey(userId), connection.id())) match
|
||||||
|
case Failure(ex) => log.warnf(ex, "Failed to destroy consumer group for connectionId=%s", connection.id())
|
||||||
|
case Success(_) => ()
|
||||||
|
}
|
||||||
|
|
||||||
private def createGroupIfAbsent(userId: String, groupName: String): Unit =
|
private def createGroupIfAbsent(userId: String, groupName: String): Unit =
|
||||||
Try(
|
Try(
|
||||||
|
|||||||
Reference in New Issue
Block a user