Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

Resourceobserver log warning - deleting releases files - only on actual deletes instead of entering routine

reger0fab445b19b4
diff --git a/source/net/yacy/peers/operation/yacyRelease.java b/source/net/yacy/peers/operation/yacyRelease.java
index 54dc4b8da..06d246526 100644
--- a/source/net/yacy/peers/operation/yacyRelease.java
+++ b/source/net/yacy/peers/operation/yacyRelease.java
@@ -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() {
diff --git a/source/net/yacy/search/ResourceObserver.java b/source/net/yacy/search/ResourceObserver.java
index ea83c34c4..a67c6c755 100644
--- a/source/net/yacy/search/ResourceObserver.java
+++ b/source/net/yacy/search/ResourceObserver.java
@@ -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