Skip to content

Commit

Permalink
client readTimeout을 30초로 연장 (PG사 환불 API응답이 늦어지는 경우 대비)
Browse files Browse the repository at this point in the history
  • Loading branch information
jangbora committed Oct 22, 2017
1 parent 4e3d608 commit fe77983
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pom.xml에 아래의 내용을 추가해주세요.
<dependency>
<groupId>com.github.iamport</groupId>
<artifactId>iamport-rest-client-java</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</dependency>
</dependencies>
```
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>com.github.iamport</groupId>
<artifactId>iamport-rest-client</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
<packaging>jar</packaging>

<name>IamportRestClient</name>
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/siot/IamportRestClient/IamportClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
Expand All @@ -22,6 +23,7 @@
import com.siot.IamportRestClient.serializer.BalanceEntrySerializer;
import com.siot.IamportRestClient.serializer.ScheduleEntrySerializer;

import okhttp3.OkHttpClient;
import retrofit2.Call;
import retrofit2.Response;
import retrofit2.Retrofit;
Expand Down Expand Up @@ -200,9 +202,15 @@ public IamportResponse<List<Schedule>> unsubscribeSchedule(UnscheduleData unsche
}

protected Iamport create() {
OkHttpClient client = new OkHttpClient.Builder()
.readTimeout(30, TimeUnit.SECONDS)
.connectTimeout(10, TimeUnit.SECONDS)
.build();

Retrofit retrofit = new Retrofit.Builder()
.baseUrl(API_URL)
.addConverterFactory(buildGsonConverter())
.client(client)
.build();

return retrofit.create(Iamport.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.siot.IamportRestClient;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import com.siot.IamportRestClient.request.payco.OrderStatusData;
import com.siot.IamportRestClient.response.AccessToken;
import com.siot.IamportRestClient.response.IamportResponse;
import com.siot.IamportRestClient.response.payco.OrderStatus;

import okhttp3.OkHttpClient;
import retrofit2.Call;
import retrofit2.Response;
import retrofit2.Retrofit;
Expand All @@ -22,9 +24,15 @@ public IamportPaycoClient(String api_key, String api_secret) {
}

private PaycoImpl createImpl() {
OkHttpClient client = new OkHttpClient.Builder()
.readTimeout(30, TimeUnit.SECONDS)
.connectTimeout(10, TimeUnit.SECONDS)
.build();

Retrofit retrofit = new Retrofit.Builder()
.baseUrl(API_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(client)
.build();

return retrofit.create(PaycoImpl.class);
Expand Down

0 comments on commit fe77983

Please sign in to comment.