Skip to content

Commit c0f56e8

Browse files
Ayyanchiravbabenkoru
authored andcommitted
Merge pull request #325 from Iterable/MOB-2680-Increase-timeout-for-Get-calls
[MOB-2680] - Increase timeout for get calls
1 parent 3d5dfa3 commit c0f56e8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

iterableapi/src/main/java/com/iterable/iterableapi/IterableRequestTask.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class IterableRequestTask extends AsyncTask<IterableApiRequest, Void, IterableAp
3030

3131
static String overrideUrl;
3232

33-
static final int DEFAULT_TIMEOUT_MS = 3000; //3 seconds
33+
static final int POST_REQUEST_DEFAULT_TIMEOUT_MS = 3000; //3 seconds
34+
static final int GET_REQUEST_DEFAULT_TIMEOUT_MS = 10000; //10 seconds
3435
static final long RETRY_DELAY_MS = 2000; //2 seconds
3536
static final int MAX_RETRY_COUNT = 5;
3637

@@ -81,8 +82,8 @@ static IterableApiResponse executeApiRequest(IterableApiRequest iterableApiReque
8182
url = new URL(builder.build().toString());
8283
urlConnection = (HttpURLConnection) url.openConnection();
8384

84-
urlConnection.setReadTimeout(DEFAULT_TIMEOUT_MS);
85-
urlConnection.setConnectTimeout(DEFAULT_TIMEOUT_MS);
85+
urlConnection.setReadTimeout(GET_REQUEST_DEFAULT_TIMEOUT_MS);
86+
urlConnection.setConnectTimeout(GET_REQUEST_DEFAULT_TIMEOUT_MS);
8687

8788
urlConnection.setRequestProperty(IterableConstants.HEADER_API_KEY, iterableApiRequest.apiKey);
8889
urlConnection.setRequestProperty(IterableConstants.HEADER_SDK_PLATFORM, "Android");
@@ -100,8 +101,8 @@ static IterableApiResponse executeApiRequest(IterableApiRequest iterableApiReque
100101
urlConnection.setDoOutput(true);
101102
urlConnection.setRequestMethod(iterableApiRequest.requestType);
102103

103-
urlConnection.setReadTimeout(DEFAULT_TIMEOUT_MS);
104-
urlConnection.setConnectTimeout(DEFAULT_TIMEOUT_MS);
104+
urlConnection.setReadTimeout(POST_REQUEST_DEFAULT_TIMEOUT_MS);
105+
urlConnection.setConnectTimeout(POST_REQUEST_DEFAULT_TIMEOUT_MS);
105106

106107
urlConnection.setRequestProperty("Accept", "application/json");
107108
urlConnection.setRequestProperty("Content-Type", "application/json");

0 commit comments

Comments
 (0)