From 0c6f072a676789f46079eef0dd1e21919c1eefbc Mon Sep 17 00:00:00 2001 From: tmdtmdqorekf Date: Thu, 23 May 2024 03:44:42 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20=EB=A7=A4=EC=B9=AD=EC=A4=91=20=EC=83=81?= =?UTF-8?q?=ED=83=9C=20=EC=97=86=EB=8D=94=EB=9D=BC=EB=8F=84=20response?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=20#308?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/match/service/MatchService.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/com/coffee/backend/domain/match/service/MatchService.java b/backend/src/main/java/com/coffee/backend/domain/match/service/MatchService.java index 23a1da9981..6ca852e349 100644 --- a/backend/src/main/java/com/coffee/backend/domain/match/service/MatchService.java +++ b/backend/src/main/java/com/coffee/backend/domain/match/service/MatchService.java @@ -394,7 +394,20 @@ private void sendMatchFinishNotification(Long fromUserId, Long toUserId) { public IsMatchingDto isMatching(Long userId) { log.trace("isMatching()"); - Map isMatchingInfo = redisTemplate.opsForHash().entries("userId:" + userId); + Map isMatchingInfo = null; + try { + isMatchingInfo = redisTemplate.opsForHash().entries("userId:" + userId); + } catch (Exception e) { + log.error("isMatching() 에러"); + } + + if (isMatchingInfo == null || isMatchingInfo.isEmpty()) { + log.warn("No matching info found for userId: {}", userId); + IsMatchingDto response = new IsMatchingDto(); + response.setIsMatching("no"); + return response; + } + Long senderId = getLongId(isMatchingInfo.get("senderId")); Long receiverId = getLongId(isMatchingInfo.get("receiverId")); User sender = userRepository.findByUserId(senderId).orElseThrow();