remove priority of subscribe

This commit is contained in:
2025-04-14 23:40:18 +02:00
parent 0bfeef8a91
commit 080ea1245d
5 changed files with 11 additions and 32 deletions
@@ -15,18 +15,14 @@ class ReactionListener(
private val eventHandler: GameEventHandler,
) {
companion object Config {
const val DEFAULT_PRIORITY = -1000
val registeredListeners = ConcurrentSkipListSet<GameProjectionBus>()
}
private val logger = KotlinLogging.logger { }
fun subscribeToBus(
projectionBus: GameProjectionBus,
priority: Int = DEFAULT_PRIORITY,
) {
fun subscribeToBus(projectionBus: GameProjectionBus) {
if (registeredListeners.add(projectionBus)) {
projectionBus.subscribe(priority) { projection: Projection<GameId> ->
projectionBus.subscribe { projection: Projection<GameId> ->
if (projection !is GameState) return@subscribe
withLoggingContext("projection" to projection.toString()) {
sendStartGameEvent(projection)