Skip to content

Commit

Permalink
Merge pull request #18 from TeamTroublePainter/feature/DRAW-416
Browse files Browse the repository at this point in the history
DRAW-416 빠른 매칭 유저 중복 등록 오류 수정
  • Loading branch information
comforest authored Nov 25, 2024
2 parents e8fb2cd + 3e88343 commit 8677787
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.xorker.draw.mafia

import com.xorker.draw.exception.AlreadyWaitingUserException
import com.xorker.draw.exception.UnSupportedException
import com.xorker.draw.user.User
import java.util.concurrent.ConcurrentHashMap
Expand All @@ -16,6 +17,9 @@ internal class MafiaGameWaitingQueueAdapter : MafiaGameWaitingQueueRepository {

override fun enqueue(user: User, locale: String) {
val queue = waitingQueue.getOrPut(locale) { ConcurrentLinkedQueue() }

queue.forEach { if (it.id == user.id) throw AlreadyWaitingUserException }

queue.add(user)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ fun XorkerException.getButtons(): List<ExceptionButtonType> {
AlreadyLinkedAccountException,
NotFoundLockKeyException,
AlreadyPlayingPlayerException,
AlreadyWaitingUserException,
-> buttonOk
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal class MafiaGameInfoWebSocketListener(
mafiaGameMessenger.broadcastPlayerList(gameInfo)
}

if (gameInfo.room.isRandomMatching) {
if (gameInfo.room.isRandomMatching && gameInfo.phase is MafiaPhase.End) {
for (player in gameInfo.room.players) {
val session = sessionManager.getSession(player.userId) ?: continue
session.origin.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ data object AlreadyJoinRoomException : ClientException("c005", "이미 참여한
data object InvalidRequestOnlyMyTurnException : ClientException("c006", "요청자의 차례가 아니라서 처리 불가능") { private fun readResolve(): Any = InvalidRequestOnlyMyTurnException }
data object InvalidRequestOtherPlayingException : ClientException("c007", "진행 중인 게임 방이 있습니다.") { private fun readResolve(): Any = InvalidRequestOtherPlayingException }
data object AlreadyPlayingRoomException : ClientException("c008", "진행 중인 게임 방에는 참여할 수 없습니다.") { private fun readResolve(): Any = AlreadyPlayingRoomException }
data object AlreadyPlayingPlayerException : ClientException("c010", "한 유저가 여러번 접속 시도를 하고 있습니다.") { private fun readResolve(): Any = AlreadyPlayingPlayerException }
data object AlreadyLinkedAccountException : ClientException("c009", "이미 소셜 계정이 연동되어 있습니다.") { private fun readResolve(): Any = AlreadyLinkedAccountException }
data object AlreadyPlayingPlayerException : ClientException("c010", "한 유저가 여러번 접속 시도를 하고 있습니다.") { private fun readResolve(): Any = AlreadyPlayingPlayerException }
data object AlreadyWaitingUserException : ClientException("c011", "이미 빠른 게임 대기열에 등록된 유저입니다.") { private fun readResolve(): Any = AlreadyWaitingUserException }

//endregion

Expand Down

0 comments on commit 8677787

Please sign in to comment.