Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] 종료 시점 처리 #89

Merged
merged 1 commit into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public void matchPlayers() throws JsonProcessingException {
.doOnSuccess(aVoid -> log.info("Player 2 세션이 성공적으로 닫혔습니다."))
.doOnError(e -> log.error("Player 2 세션 닫기 실패", e))
.subscribe();

MatchingQueue.deleteSession(player1.getKey(),player2.getKey());
}
else{
if(player1.getValue().isOpen()){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,13 @@ public static void requeue(Map.Entry<String, WebSocketSession> player){
queueing.addFirst(player);
}

public static void deleteSession(String userId1,String userId2){
WebSocketSession session1 = sessionMap.remove(userId1);
WebSocketSession session2 = sessionMap.remove(userId2);
queueing.removeIf(entry ->
entry.getKey().equals(userId1) || entry.getKey().equals(userId2)
);
}


}
Loading