From 377b98d677180772e9acf098f785aa5d6afd8c1b Mon Sep 17 00:00:00 2001 From: LSmyrnaios Date: Tue, 22 Feb 2022 13:29:02 +0200 Subject: [PATCH] Increase the "requestReadTimeoutDuration" from 1 hour to 3. This way, each worker will handle saturation without aborting the connection, when multiple workers are waiting for the "databaseLock" in the Controller. --- installAndRun.sh | 3 +-- .../java/eu/openaire/urls_worker/util/AssignmentsHandler.java | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/installAndRun.sh b/installAndRun.sh index edcec00..96666e7 100755 --- a/installAndRun.sh +++ b/installAndRun.sh @@ -78,8 +78,7 @@ if [[ justInstall -eq 0 ]]; then #gradle tasks # For debugging installation #gradle -v # For debugging installation - gradle clean - gradle build + gradle clean build else export PATH=/opt/gradle/gradle-${gradleVersion}/bin:$PATH # Make sure the gradle is still accessible (it usually isn't without the "export"). fi diff --git a/src/main/java/eu/openaire/urls_worker/util/AssignmentsHandler.java b/src/main/java/eu/openaire/urls_worker/util/AssignmentsHandler.java index 889540e..8c9ed0e 100644 --- a/src/main/java/eu/openaire/urls_worker/util/AssignmentsHandler.java +++ b/src/main/java/eu/openaire/urls_worker/util/AssignmentsHandler.java @@ -35,7 +35,7 @@ public class AssignmentsHandler { private static String requestUrl; private static final Duration requestConnectTimeoutDuration = Duration.ofMinutes(1); // 1 minute. - private static final Duration requestReadTimeoutDuration = Duration.ofMinutes(60); // 60 minutes. Time to wait for the data to get transferred over the network. Many workers may try to get assignments from the Worker, so each worker might have to wait some 10s of minutes for work. + private static final Duration requestReadTimeoutDuration = Duration.ofHours(3); // 3 hours. Time to wait for the data to get transferred over the network. Many workers may try to get assignments from the Worker, so each worker might have to wait some 10s of minutes for work. // The controller has to retrieve the data from the database, then prepare them in memory, insert them in the "assignment"-table and, finally, return them to the worker. public static final RestTemplate restTemplate = new RestTemplateBuilder().setConnectTimeout(requestConnectTimeoutDuration).setReadTimeout(requestReadTimeoutDuration).build(); @@ -64,7 +64,7 @@ public class AssignmentsHandler { try { // Here, the HTTP-request is executed. assignmentRequest = restTemplate.getForObject(requestUrl, AssignmentsRequest.class); } catch (RestClientException rce) { - logger.error("Could not retrieve the assignments!\n" + rce.getMessage()); // It shows the response body (after Spring v.2.5.6). + logger.error("Could not retrieve the assignments!\n" + rce.getMessage()); // It shows the response body (from Spring v.2.5.6 onwards). hadConnectionErrorOnRequest = true; return null; }