Skip to content

Commit c0916fd

Browse files
committed
refactor: token 부족으로 호출이 불가능한 이슈를 수정한다
1 parent 20e1959 commit c0916fd

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import org.gitanimals.render.domain.UserService
88
import org.gitanimals.render.domain.event.NewUserCreated
99
import org.gitanimals.render.domain.event.Visited
1010
import org.rooftop.netx.api.SagaManager
11+
import org.slf4j.LoggerFactory
1112
import org.slf4j.MDC
1213
import org.springframework.context.ApplicationEventPublisher
1314
import org.springframework.stereotype.Service
@@ -22,6 +23,8 @@ class AnimationFacade(
2223
private val githubOpenApi: GithubOpenApi,
2324
) {
2425

26+
private val logger = LoggerFactory.getLogger(this::class.simpleName)
27+
2528
fun getFarmAnimation(username: String): String {
2629
return when (userService.existsByName(username)) {
2730
true -> {
@@ -59,15 +62,19 @@ class AnimationFacade(
5962
}
6063

6164
private fun setUserAuthInfoIfNotSet(username: String) {
62-
val user = userService.getUserByName(username)
65+
runCatching {
66+
val user = userService.getUserByName(username)
6367

64-
if (user.isAuthInfoSet().not()) {
65-
val githubUserAuthInfo = githubOpenApi.getGithubUser(user.getName())
66-
userService.setAuthInfo(
67-
name = user.getName(),
68-
entryPoint = EntryPoint.GITHUB,
69-
githubUserAuthInfo.id,
70-
)
68+
if (user.isAuthInfoSet().not()) {
69+
val githubUserAuthInfo = githubOpenApi.getGithubUser(user.getName())
70+
userService.setAuthInfo(
71+
name = user.getName(),
72+
entryPoint = EntryPoint.GITHUB,
73+
githubUserAuthInfo.id,
74+
)
75+
}
76+
}.onFailure {
77+
logger.info("Fail to update userAuthInfo cause: ${it.message}", it)
7178
}
7279
}
7380

0 commit comments

Comments
 (0)