Increase HTTP timeouts.

This commit is contained in:
Mark Nellemann 2021-02-25 14:50:21 +01:00
parent b148876391
commit 7c1c9b2fe1
3 changed files with 11 additions and 8 deletions

View file

@ -1,3 +1,3 @@
id = hmci
group = biz.nellemann.hmci
version = 1.1.4
version = 1.1.5

View file

@ -28,7 +28,6 @@ import java.util.concurrent.Callable;
@Command(name = "hmci",
mixinStandardHelpOptions = true,
description = "HMC Insights.",
versionProvider = biz.nellemann.hmci.VersionProvider.class)
public class Application implements Callable<Integer> {
@ -59,11 +58,9 @@ public class Application implements Callable<Integer> {
switch (enableDebug.length) {
case 1:
System.out.println("DEBUG");
System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "DEBUG");
break;
case 2:
System.out.println("TRACE");
System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "TRACE");
break;
}

View file

@ -50,9 +50,9 @@ public class HmcRestClient {
private final OkHttpClient client;
// OkHttpClient timeouts
private final static int CONNECT_TIMEOUT = 15;
private final static int WRITE_TIMEOUT = 15;
private final static int READ_TIMEOUT = 15;
private final static int CONNECT_TIMEOUT = 30;
private final static int WRITE_TIMEOUT = 30;
private final static int READ_TIMEOUT = 30;
private final String baseUrl;
private final String username;
@ -117,7 +117,7 @@ public class HmcRestClient {
log.error("login() - URL Error: " + e.getMessage());
throw e;
} catch (Exception e) {
log.error("login() - Error", e);
log.error("login() - Error: " + e.getMessage());
throw e;
}
@ -409,6 +409,9 @@ public class HmcRestClient {
private String sendGetRequest(URL url) throws Exception {
log.trace("getResponse() - " + url.toString());
if(authToken == null) {
return null;
}
Request request = new Request.Builder()
.url(url)
@ -448,6 +451,9 @@ public class HmcRestClient {
public String sendPostRequest(URL url, String payload) throws Exception {
log.trace("sendPostRequest() - " + url.toString());
if(authToken == null) {
return null;
}
RequestBody requestBody;
if(payload != null) {