Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: lsiepel <leosiepel@gmail.com>
  • Loading branch information
lsiepel committed Aug 12, 2023
1 parent f24f0f0 commit ff6fd06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Arrays;
import java.util.Enumeration;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import org.eclipse.jdt.annotation.NonNullByDefault;
Expand Down Expand Up @@ -108,7 +109,7 @@ public synchronized void login(String username, String password) throws Authenti
setConnectionHeaders(request);
request.content(new StringContentProvider(SurePetcareConstants.GSON
.toJson(new SurePetcareLoginCredentials(username, password, getDeviceId().toString()))));
ContentResponse response = request.send();
ContentResponse response = request.timeout(SurePetcareConstants.DEFAULT_HTTP_TIMEOUT, TimeUnit.SECONDS).send();
if (response.getStatus() == HttpURLConnection.HTTP_OK) {
SurePetcareLoginResponse loginResponse = SurePetcareConstants.GSON
.fromJson(response.getContentAsString(), SurePetcareLoginResponse.class);
Expand Down Expand Up @@ -450,7 +451,7 @@ private ContentResponse executeAPICall(Request request) throws SurePetcareApiExc
while (retries > 0) {
try {
setConnectionHeaders(request);
ContentResponse response = request.send();
ContentResponse response = request.timeout(SurePetcareConstants.DEFAULT_HTTP_TIMEOUT, TimeUnit.SECONDS).send();
if ((response.getStatus() == HttpURLConnection.HTTP_OK)
|| (response.getStatus() == HttpURLConnection.HTTP_CREATED)) {
return response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public class SurePetcareConstants {

public static final long DEFAULT_REFRESH_INTERVAL_TOPOLOGY = 36000; // 10 hours
public static final long DEFAULT_REFRESH_INTERVAL_STATUS = 300; // 5 mins
public static final int DEFAULT_HTTP_TIMEOUT = 8;

public static final String PROPERTY_NAME_ID = "id";

Expand Down

0 comments on commit ff6fd06

Please sign in to comment.