From ee1ca8966b4b92c12da038da97e1fbb29f22ad59 Mon Sep 17 00:00:00 2001 From: LSmyrnaios Date: Mon, 15 Jan 2024 12:57:33 +0200 Subject: [PATCH] - Avoid continuing to request workerReport-batches when from the 1st batch, the base-directory of that assignments-counter is not found. - Update dependencies. --- build.gradle | 4 ++-- .../java/eu/openaire/urls_controller/util/FileUtils.java | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index a903f4d..ef1105f 100644 --- a/build.gradle +++ b/build.gradle @@ -43,7 +43,7 @@ dependencies { //implementation group: 'jakarta.validation', name: 'jakarta.validation-api', version: '3.0.2' // https://mvnrepository.com/artifact/com.google.guava/guava - implementation group: 'com.google.guava', name: 'guava', version: '32.1.3-jre' + implementation group: 'com.google.guava', name: 'guava', version: '33.0.0-jre' // https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.14.0' @@ -120,7 +120,7 @@ dependencies { // https://mvnrepository.com/artifact/io.micrometer/micrometer-registry-prometheus - runtimeOnly 'io.micrometer:micrometer-registry-prometheus:1.12.1' + runtimeOnly 'io.micrometer:micrometer-registry-prometheus:1.12.2' testImplementation 'org.springframework.security:spring-security-test' testImplementation "org.springframework.boot:spring-boot-starter-test" diff --git a/src/main/java/eu/openaire/urls_controller/util/FileUtils.java b/src/main/java/eu/openaire/urls_controller/util/FileUtils.java index d098c68..416900b 100644 --- a/src/main/java/eu/openaire/urls_controller/util/FileUtils.java +++ b/src/main/java/eu/openaire/urls_controller/util/FileUtils.java @@ -483,8 +483,10 @@ public class FileUtils { logger.warn("Problem when getting the \"status-code\" for url: " + requestUrl); throw new RuntimeException(); // Avoid any other batches. } else if ( statusCode != 200 ) { - logger.warn("HTTP-" + statusCode + ": " + getMessageFromResponseBody(conn, true) + "\n\nProblem when requesting the ZstdFile of batch_" + batchNum + " from the Worker with ID \"" + workerId + "\" and requestUrl: " + requestUrl); - if ( (statusCode >= 500) && (statusCode <= 599) ) + String errMsg = getMessageFromResponseBody(conn, true); + logger.warn("HTTP-" + statusCode + ": " + errMsg + "\n\nProblem when requesting the ZstdFile of batch_" + batchNum + " from the Worker with ID \"" + workerId + "\" and requestUrl: " + requestUrl); + if ( ((statusCode >= 500) && (statusCode <= 599)) + || ((statusCode == 400) && ((errMsg != null) && errMsg.contains("The base directory for assignments_" + assignmentsBatchCounter + " was not found"))) ) throw new RuntimeException(); // Throw an exception to indicate that the Worker has problems and all remaining batches will fail as well. return null; } else