- Fix a bug, which caused the old full-text files to not be deleted.

- Reduce the "InitialDelay" for the "checkIfShouldShutdown" scheduler.
This commit is contained in:
Lampros Smyrnaios 2023-05-24 16:47:53 +03:00
parent 0ca02f3587
commit 1bf27a5a4e
1 changed files with 4 additions and 4 deletions

View File

@ -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;
}