diff --git a/src/main/java/com/depromeet/breadmapbackend/domain/search/SearchLogServiceImpl.java b/src/main/java/com/depromeet/breadmapbackend/domain/search/SearchLogServiceImpl.java index f4bcc024..bc3c638b 100644 --- a/src/main/java/com/depromeet/breadmapbackend/domain/search/SearchLogServiceImpl.java +++ b/src/main/java/com/depromeet/breadmapbackend/domain/search/SearchLogServiceImpl.java @@ -9,6 +9,7 @@ import org.springframework.stereotype.Service; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -41,9 +42,15 @@ public void saveRecentSearchLog(String oauthId, String keyword) { @Override public List getRecentSearchLogs(String oauthId) { String key = searchLogKey(oauthId); - List range = redisTemplate.opsForList() - .range(key, 0, RECENT_KEYWORD_SIZE); + List range = new ArrayList<>(); + try { + range = redisTemplate.opsForList() + .range(key, 0, RECENT_KEYWORD_SIZE); + } catch (Exception e) { + log.error("getRecentSearchLogs error: " + key); + } + return Objects.requireNonNull(range).stream().map(SearchLog::getKeyword).toList(); }