Skip to content

Commit

Permalink
[fix] 매칭중 상태 없더라도 response하도록 수정 #308
Browse files Browse the repository at this point in the history
  • Loading branch information
tmdtmdqorekf committed May 22, 2024
1 parent c440b8e commit 0c6f072
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,20 @@ private void sendMatchFinishNotification(Long fromUserId, Long toUserId) {
public IsMatchingDto isMatching(Long userId) {
log.trace("isMatching()");

Map<Object, Object> isMatchingInfo = redisTemplate.opsForHash().entries("userId:" + userId);
Map<Object, Object> 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();
Expand Down

0 comments on commit 0c6f072

Please sign in to comment.