Resourceobserver log warning - deleting releases files - only on actual deletes

instead of entering routine
pull/8/head
reger 10 years ago
parent ef6a64b2a4
commit 0fab445b19

@ -568,15 +568,17 @@ public final class yacyRelease extends yacyVersion {
}
/**
* keep only releases of last month (minimum latest and 1 main (maybe the same))
* keep only releases older as deleteAfterDays (keep minimum latest and 1 main (maybe the same))
*
* @param filesPath where all downloaded files reside
* @param deleteAfterDays
* @return true = some files deleted
*/
public static void deleteOldDownloads(final File filesPath, final int deleteAfterDays) {
public static boolean deleteOldDownloads(final File filesPath, final int deleteAfterDays) {
// list downloaded releases
yacyVersion release;
final String[] downloaded = filesPath.list();
boolean deletedSomeFiles = false;
// parse all filenames and put them in a sorted set
final SortedSet<yacyVersion> downloadedreleases = new TreeSet<yacyVersion>();
@ -623,10 +625,13 @@ public final class yacyRelease extends yacyVersion {
FileUtils.deletedelete(new File(downloadedFile.getAbsolutePath() + ".sig"));
if (downloadedFile.exists()) {
ConcurrentLog.warn("STARTUP", "cannot delete old release " + downloadedFile.getAbsolutePath());
} else {
deletedSomeFiles = true;
}
}
}
}
return deletedSomeFiles;
}
public File getReleaseFile() {

@ -107,8 +107,7 @@ public class ResourceObserver {
(this.normalizedDiskUsed == Space.EXHAUSTED && this.sb.getConfigBool(SwitchboardConstants.RESOURCE_DISK_USED_AUTOREGULATE, false))) {
shrinkmethods: while (true /*this is not a loop, just a construct that we can leave with a break*/) {
// delete old releases
log.warn("DISK SPACE EXHAUSTED - deleting downloaded releases files");
yacyRelease.deleteOldDownloads(sb.releasePath, 1);
if (yacyRelease.deleteOldDownloads(sb.releasePath, 1)) log.warn("DISK SPACE EXHAUSTED - deleting downloaded releases files");
if (getNormalizedDiskFree() == Space.AMPLE && getNormalizedDiskUsed(false) == Space.AMPLE) break;
// clear HTCACHE

Loading…
Cancel
Save