Conversation
- 인증이 필요 없는 API 처리를 위한 LoginService 추가 및 관련 로직 이동 - AuthInterceptor 내 No-Service-Token 헤더 체크 및 삭제 로직 제거
Walkthrough이 PR은 네트워크 모듈의 구조를 개선하는 대규모 리팩토링입니다. OkHttpClient 구성을 기본 클라이언트에서 특화된 클라이언트로 분리하고, 로그인 기능을 AuthService에서 새로운 LoginService로 분리했습니다. 또한 불필요한 헤더 처리 로직을 제거하고 OkHttp와 Retrofit을 최신 버전으로 업데이트했습니다. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can disable poems in the walkthrough.Disable the |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/src/main/java/com/threegap/bitnagil/di/core/NetworkModule.kt`:
- Around line 104-120: The None-auth and Auth OkHttp clients created by
provideNoneAuthOkHttpClient and provideAuthOkHttpClient currently share the
baseClient Dispatcher via OkHttpClient.newBuilder(), which can cause
deadlock/starvation when TokenAuthenticator does runBlocking reissue calls; fix
by creating a dedicated Dispatcher for the auth/reissue path and assign it to
the auth client builder (use a new Dispatcher with its own executor or thread
pool) so the client used by TokenAuthenticator/ReissueService does not share the
baseClient dispatcher; update provideAuthOkHttpClient to set that Dispatcher on
the newBuilder() before build().
In
`@core/network/src/main/java/com/threegap/bitnagil/network/auth/AuthInterceptor.kt`:
- Line 15: AuthInterceptor currently does a pass-through when
token.isNullOrBlank() which causes TokenAuthenticator.authenticate() to treat
the 401 as unauthenticated and attempt unnecessary refreshes; update
AuthInterceptor.intercept to either fail-fast for auth-only clients (e.g., throw
an IOException or return an immediate 401-like failure) when token is absent, or
annotate the outgoing request with a skip-refresh marker header (e.g.,
"X-Skip-Refresh": "1") so TokenAuthenticator.authenticate() can check that
header and avoid refresh logic; modify TokenAuthenticator.authenticate()
accordingly to short-circuit refresh when that header is present.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6248c669-7484-49b5-a137-7ae4a0bbb2ca
📒 Files selected for processing (9)
app/src/main/java/com/threegap/bitnagil/di/core/NetworkModule.ktapp/src/main/java/com/threegap/bitnagil/di/data/ServiceModule.ktbuild-logic/convention/src/main/java/com/threegap/bitnagil/convention/extension/KotlinAndroid.ktcore/network/src/main/java/com/threegap/bitnagil/network/auth/AuthInterceptor.ktcore/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.ktdata/src/main/java/com/threegap/bitnagil/data/auth/datasourceimpl/AuthRemoteDataSourceImpl.ktdata/src/main/java/com/threegap/bitnagil/data/auth/service/AuthService.ktdata/src/main/java/com/threegap/bitnagil/data/auth/service/LoginService.ktgradle/libs.versions.toml
💤 Files with no reviewable changes (2)
- data/src/main/java/com/threegap/bitnagil/data/auth/service/AuthService.kt
- core/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.kt
[ PR Content ]
Related issue
Work Description
To Reviewers 📢
@Auth,@NoneAuth,@Kakao등 각각의 목적에 맞는 클라이언트를 생성할 때 매번OkHttpClient.Builder().build()를 독립적으로 호출합니다. 이 경우 클라이언트가 생성될 때마다 내부적으로 별도의 커넥션 풀과 스레드 풀이 각각 새로 만들어지는 문제가 있습니다. 이를baseClient.newBuilder()를 활용해 단일 Base 클라이언트를 하나만 생성하고 이를 기반으로 생성되도록 수정했습니다.개선 효과: 앱 전체의 네트워크 요청이 단 1개의 스레드풀과 커넥션풀을 공유하게 됩니다!
Summary by CodeRabbit
릴리스 노트
새로운 기능
개선사항
리팩토링