From 1bf27a5a4e7eb4ef0b280e263c64cbc7d9ca1d82 Mon Sep 17 00:00:00 2001 From: LSmyrnaios Date: Wed, 24 May 2023 16:47:53 +0300 Subject: [PATCH] - Fix a bug, which caused the old full-text files to not be deleted. - Reduce the "InitialDelay" for the "checkIfShouldShutdown" scheduler. --- .../openaire/urls_worker/components/ScheduledTasks.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 c5dbd63..d255fa2 100644 --- a/src/main/java/eu/openaire/urls_worker/components/ScheduledTasks.java +++ b/src/main/java/eu/openaire/urls_worker/components/ScheduledTasks.java @@ -65,7 +65,7 @@ public class ScheduledTasks { } - @Scheduled(initialDelay = 1_800_000, fixedDelay = 1_800_000) + @Scheduled(initialDelay = 900_000, fixedDelay = 1_800_000) // InitialDelay = 15 mins, FixedDelay = 30 mins. public void checkIfShouldShutdown() { if ( !GeneralController.shouldShutdownWorker && !AssignmentsHandler.shouldNotRequestMore ) @@ -99,7 +99,7 @@ public class ScheduledTasks { private static final int hoursToWaitBeforeDeletion = 36; - @Scheduled(initialDelay = 21_600_000, fixedDelay = 21_600_000) + @Scheduled(initialDelay = 21_600_000, fixedDelay = 21_600_000) // InitialDelay & FixedDelay = 36 hours. public void checkAndDeleteOldFiles() { // For any reason the Worker-report connection with the Controller may fail, but the Controller will continue requesting the full-text batches. @@ -119,8 +119,8 @@ public class ScheduledTasks { int usableDirsNum = 0; try { File fullTextsBaseDir = new File(fileStorageService.assignmentsBaseLocation); - if ( fullTextsBaseDir.isDirectory() ) { - logger.warn("The full-texts directory still exists, wait for the Controller to take all the files or some time to past before they are deleted. Then the Worker will shut down."); + if ( !fullTextsBaseDir.isDirectory() ) { + logger.error("The \"fullTextsBaseDir\" (" + fileStorageService.assignmentsBaseLocation + ") does not exist!"); // This base dir should always exist during execution! return; }