From 5dadb8ad2f6b566258bf4a691d1130882b2e887c Mon Sep 17 00:00:00 2001 From: LSmyrnaios Date: Fri, 19 Jan 2024 15:46:23 +0200 Subject: [PATCH] - Optimize the "DOC_URL_FILTER"-regex, by using a non-capturing group. - Remove an extra "File.separator" from the fulltexts-fullFilePath. --- build.gradle | 2 +- .../eu/openaire/urls_controller/services/UrlsServiceImpl.java | 4 ++-- src/main/java/eu/openaire/urls_controller/util/FileUtils.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index ef1105f..9680442 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ plugins { java { group = 'eu.openaire.urls_controller' - version = '2.7.0-SNAPSHOT' + version = '2.6.3-SNAPSHOT' sourceCompatibility = JavaVersion.VERSION_1_8 } diff --git a/src/main/java/eu/openaire/urls_controller/services/UrlsServiceImpl.java b/src/main/java/eu/openaire/urls_controller/services/UrlsServiceImpl.java index 48106cc..82f023b 100644 --- a/src/main/java/eu/openaire/urls_controller/services/UrlsServiceImpl.java +++ b/src/main/java/eu/openaire/urls_controller/services/UrlsServiceImpl.java @@ -68,7 +68,7 @@ public class UrlsServiceImpl implements UrlsService { private static String excludedDatasourceIDsStringList = null; - private static final String DOC_URL_FILTER = ".+(pdf|download|/doc|document|(?:/|[?]|&)file|/fulltext|attachment|/paper|viewfile|viewdoc|/get|cgi/viewcontent.cgi\\?|t[ée]l[ée]charger|descargar).*"; + private static final String DOC_URL_FILTER = ".+(?:pdf|download|/doc|document|(?:/|[?]|&)file|/fulltext|attachment|/paper|viewfile|viewdoc|/get|cgi/viewcontent.cgi\\?|t[ée]l[ée]charger|descargar).*"; // "DOC_URL_FILTER" works for lowerCase Strings (we use the "ignore-case" indicator in the "regexp_like()" method). @@ -329,7 +329,7 @@ public class UrlsServiceImpl implements UrlsService { DatabaseConnector.databaseLock.lock(); // Lock the DB here so the prefilled-Payloads which will be generated inside the "getTasksForCreatingAndUploadingParquetFiles()" method (using a dedicated query) - // will be synchronized with the insert of all attempt and payload records to the DB. + // will be synchronized with the insert of all attempt and payload records to the DB. This action is NOT a callable-task, so it runs during the execution of this method. // This is important in order to avoid having workers take these records as assignments, when we know that payloads are ready to be inserted for them. List> callableTasks = parquetFileUtils.getTasksForCreatingAndUploadingParquetFiles(urlReports, sizeOfUrlReports, curReportAssignmentsCounter, localParquetPath, uploadFullTextsResponse); 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 416900b..da1b3fe 100644 --- a/src/main/java/eu/openaire/urls_controller/util/FileUtils.java +++ b/src/main/java/eu/openaire/urls_controller/util/FileUtils.java @@ -598,7 +598,7 @@ public class FileUtils { if ( filenameForS3 == null ) // The error is logged inside. return null; - String fileFullPath = targetDirectory + File.separator + fileName; // The fullPath to the local file (which has the previous name). + String fileFullPath = targetDirectory + fileName; // The fullPath to the local file (which has the previous name). String s3Url = null; try { s3Url = s3ObjectStore.uploadToS3(filenameForS3, fileFullPath);