Skip to content

Commit

Permalink
fix: increase patient sync request timeout (#107)
Browse files Browse the repository at this point in the history
- gives kenya emr room to synchronize mycarehub backend server

Signed-off-by: Kathurima Kimathi <[email protected]>
  • Loading branch information
KathurimaKimathi authored Aug 30, 2023
1 parent 52ddf9e commit aef54e6
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import org.apache.commons.logging.Log;
Expand All @@ -20,6 +21,8 @@ public class ApiClient {

private static Retrofit retrofit = null;

private static final long timeoutDuration = 2;

public static <S> RestApiService getRestService() {
if (retrofit == null) {
Gson gson =
Expand All @@ -30,7 +33,12 @@ public static <S> RestApiService getRestService() {
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);

OkHttpClient client = new OkHttpClient.Builder().addInterceptor(loggingInterceptor).build();
OkHttpClient client =
new OkHttpClient.Builder()
.addInterceptor(loggingInterceptor)
.connectTimeout(timeoutDuration, TimeUnit.MINUTES)
.readTimeout(timeoutDuration, TimeUnit.MINUTES)
.build();
retrofit =
new Retrofit.Builder()
.baseUrl(apiUrl)
Expand Down

0 comments on commit aef54e6

Please sign in to comment.