- Increase the "hoursToWaitBeforeDeletion" to 48.

- Adjust the number and size of log files.
This commit is contained in:
Lampros Smyrnaios 2023-08-31 17:54:07 +03:00
parent e85282d35b
commit 49cd0c19c2
2 changed files with 4 additions and 7 deletions

View File

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

View File

@ -7,11 +7,11 @@
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>logs/UrlsWorker.%i.log.zip</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>20</maxIndex>
<maxIndex>10</maxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>50MB</maxFileSize>
<maxFileSize>100MB</maxFileSize>
</triggeringPolicy>
<encoder>
<charset>UTF-8</charset>