diff --git a/src/main/java/eu/openaire/urls_worker/components/AssignmentsHandler.java b/src/main/java/eu/openaire/urls_worker/components/AssignmentsHandler.java index ae83e05..36d1ceb 100644 --- a/src/main/java/eu/openaire/urls_worker/components/AssignmentsHandler.java +++ b/src/main/java/eu/openaire/urls_worker/components/AssignmentsHandler.java @@ -55,7 +55,7 @@ public class AssignmentsHandler { private static final boolean askForTest = false; // Enable this only for testing. private static String requestUrl; - public static final RestTemplate restTemplate = new RestTemplateBuilder().setConnectTimeout(Duration.ofMinutes(2)).setReadTimeout(Duration.ofHours(1)).build(); + public static final RestTemplate restTemplate = new RestTemplateBuilder().setConnectTimeout(Duration.ofMinutes(2)).setReadTimeout(Duration.ofHours(2)).build(); public static boolean hadConnectionErrorOnRequest = false; @@ -108,18 +108,8 @@ public class AssignmentsHandler { try { // Here, the HTTP-request is executed. assignmentRequest = restTemplate.getForObject(requestUrl, AssignmentsRequest.class); } catch (RestClientException rce) { - final String errorMsg = "Could not retrieve the assignments! "; - String exceptionMsg = rce.getMessage(); // It also shows the response body of the response (from Spring v.2.5.6 onwards). - if ( (exceptionMsg != null) && !exceptionMsg.isEmpty() ) { - hadConnectionErrorOnRequest = true; - logger.error(errorMsg + exceptionMsg); - } - else { // Otherwise, it's an undefined error, which occurs randomly - // and does not mean that the Controller has some problem, or the Worker requested something in a wrong way, - // or that the firewall disallow the connection (in this case we get "connection refused/timed out"). - logger.error(errorMsg, rce); - // Try again immediately, do not wait 15 mins. The Controller will take some minutes to prepare the data, before it sends them anyway. - } + logger.error("Could not retrieve the assignments! " + rce.getMessage()); // The exMsg also shows the response body of the response (from Spring v.2.5.6 onwards). + hadConnectionErrorOnRequest = true; return null; } catch (IllegalArgumentException iae) { logger.error("Could not retrieve the assignments, as the provided Controller's url was malformed! " + iae.getMessage());