Connect Timeout
Read Timeout
Write Timeout
OkHttpClient.Builder builder = new OkHttpClient.Builder();
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(VansBuildConfig.DEBUGGABLE ? HttpLoggingInterceptor.Level.BODY : HttpLoggingInterceptor.Level.NONE);
builder.addInterceptor(loggingInterceptor);
builder.connectTimeout(60, TimeUnit.SECONDS);
builder.readTimeout(90, TimeUnit.SECONDS); //받는(응답기다림)
builder.writeTimeout(60, TimeUnit.SECONDS); //보내는거(요청시간)
if (interceptor != null) {
builder.addInterceptor(interceptor);
}
참고.
https://square.github.io/okhttp/4.x/okhttp/okhttp3/-ok-http-client/-builder/read-timeout/
https://effectivesquid.tistory.com/entry/Timeout%EC%97%90-%EA%B4%80%ED%95%9C-%EC%A0%95%EB%A6%AC
반응형
'Platform > Android' 카테고리의 다른 글
[gradle] BuildConfig 변수 생성/사용하기 (0) | 2021.12.10 |
---|---|
setAllowFileAccess (0) | 2021.10.22 |
[TroubleShooting] androidx.constraintlayout.widget.Group 사용 시, visibility 적용 안될 때 (2) | 2021.08.30 |
[WebView] Android SDK 버전별 WebView 버전 확인 (0) | 2021.07.27 |
[gradle] ViewBinding 추가 (0) | 2021.07.25 |