From 49cd0c19c2d3eeed1b4759eb8c4bd632c9a09dac Mon Sep 17 00:00:00 2001 From: LSmyrnaios Date: Thu, 31 Aug 2023 17:54:07 +0300 Subject: [PATCH] - Increase the "hoursToWaitBeforeDeletion" to 48. - Adjust the number and size of log files. --- .../eu/openaire/urls_worker/components/ScheduledTasks.java | 7 ++----- src/main/resources/logback-spring.xml | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/eu/openaire/urls_worker/components/ScheduledTasks.java b/src/main/java/eu/openaire/urls_worker/components/ScheduledTasks.java index ead7ba6..97cdeb2 100644 --- a/src/main/java/eu/openaire/urls_worker/components/ScheduledTasks.java +++ b/src/main/java/eu/openaire/urls_worker/components/ScheduledTasks.java @@ -133,7 +133,7 @@ public class ScheduledTasks { private static final Pattern ASSIGNMENTS_COUNTER = Pattern.compile(".*assignments_([\\d]+).*"); - private static final double hoursToWaitBeforeDeletion = 36.0; + private static final double hoursToWaitBeforeDeletion = 48.0; private static final int hoursDivisor = (1000 * 60 * 60); // In order to get the time-difference in hours. We divide with: /1000 to get seconds, /60 to get minutes and /60 to get hours. @@ -161,13 +161,11 @@ public class ScheduledTasks { logger.error("The \"fullTextsBaseDir\" (" + fileStorageService.assignmentsBaseLocation + ") does not exist!"); // This base dir should always exist during execution! return; } - File[] fulltextSubDirs = fullTextsBaseDir.listFiles(File::isDirectory); if ( fulltextSubDirs == null ) { logger.error("There was an error when getting the subDirs of \"fullTextsBaseDir\": " + fullTextsBaseDir); return; } - usableDirsNum = fulltextSubDirs.length; if ( usableDirsNum == 0 ) { logger.debug("The \"fullTextsBaseDir\" is empty, so there is nothing to delete."); @@ -198,8 +196,7 @@ public class ScheduledTasks { if ( (assingmentsCounterString != null) && !assingmentsCounterString.isEmpty()) { if ( FullTextsController.deleteFile(this.workerReportsDirPath + this.workerId + "_assignments_" + assingmentsCounterString + "_report.json") ) logger.warn("The subDir \"" + subDirName + "\" probably contains some failed files, since the workerReport for assignments_" + assingmentsCounterString + " was deleted only now, which means the Controller failed to successfully process the results of those assignments."); - } - else + } else logger.error("The subDir \"" + subDirName + "\" has an invalid name! It does not contains the assignmentsCounter!"); } else logger.error("The subDir \"" + subDirName + "\" has an invalid name! It could not be matched with regex: " + ASSIGNMENTS_COUNTER); diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 4e65b53..40bffc7 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -7,11 +7,11 @@ logs/UrlsWorker.%i.log.zip 1 - 20 + 10 - 50MB + 100MB UTF-8