Skip to content

Commit

Permalink
feat:TOP-106 Local에 캐싱된 Topic이 없는 경우 에러 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
cwj-c committed Jan 5, 2025
1 parent 171d094 commit 23dabda
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ class FetchToHotStateUseCase(
size: Int = 10
): Result<ToHotStateModel> {
return kotlin.runCatching {
val topicCachedFromLocal = topicRepository.fetchDailyTopicFromLocal()
val topic = if (now > topicCachedFromLocal.topicResetTimeMill) {
val topicCachedFromLocal = runCatching {
topicRepository.fetchDailyTopicFromLocal()
}.getOrNull()
val topic = if (
topicCachedFromLocal == null || now > topicCachedFromLocal.topicResetTimeMill
) {
fetchDailyTopicListUseCase().getOrThrow()
} else {
topicCachedFromLocal
Expand Down

0 comments on commit 23dabda

Please sign in to comment.