Skip to content

Commit

Permalink
DRAW-400 feat: 게임 결과 화면에서 빠른 매칭 케이스 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
comforest committed Oct 16, 2024
1 parent c0a8647 commit ca96b8c
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.xorker.draw.mafia.MafiaGameResultRepository
import com.xorker.draw.mafia.MafiaPhase
import com.xorker.draw.mafia.assertIs
import com.xorker.draw.timer.TimerRepository
import java.time.Duration
import org.springframework.stereotype.Component

@Component
Expand All @@ -25,10 +26,6 @@ internal class MafiaPhaseEndGameProcessor(

val room = gameInfo.room

timerRepository.startTimer(room.id, gameOption.endTime) {
processEndGame(gameInfo)
}

val endPhase = assertAndGetEndPhase(phase)

judgeGameResult(endPhase)
Expand All @@ -39,6 +36,15 @@ internal class MafiaPhaseEndGameProcessor(

mafiaGameResultRepository.saveMafiaGameResult(gameInfo)

if (room.isRandomMatching) {
timerRepository.startTimer(room.id, Duration.ofMillis(1)) {
mafiaGameRepository.removeGameInfo(gameInfo)
}
} else {
timerRepository.startTimer(room.id, gameOption.endTime) {
processEndGame(gameInfo)
}
}
return endPhase
}

Expand Down

0 comments on commit ca96b8c

Please sign in to comment.