[pkg-d-commits] [ldc] 18/211: ir2obj-cache: fix bugs in relative size pruning.

Matthias Klumpp mak at moszumanska.debian.org
Sun Apr 23 22:36:05 UTC 2017


This is an automated email from the git hooks/post-receive script.

mak pushed a commit to annotated tag v1.1.0
in repository ldc.

commit 2649c94be064e65762b8de565f1e3aa5c96c60ba
Author: Johan Engelen <jbc.engelen at gmail.com>
Date:   Sat Sep 17 20:04:19 2016 +0200

    ir2obj-cache: fix bugs in relative size pruning.
---
 driver/ir2obj_cache_pruning.d | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/driver/ir2obj_cache_pruning.d b/driver/ir2obj_cache_pruning.d
index 36e0658..01853cd 100644
--- a/driver/ir2obj_cache_pruning.d
+++ b/driver/ir2obj_cache_pruning.d
@@ -79,7 +79,7 @@ struct CachePruner
     Duration expireDuration; // cache file expiration
     ulong sizeLimit; // in bytes
     uint sizeLimitPercentage; // Percentage limit of available space
-    bool willPruneForSize;
+    bool willPruneForSize; // true if we need to prune for absolute/relative size
 
     this(string cachePath, uint pruneIntervalSeconds, uint expireIntervalSeconds,
         ulong sizeLimit, uint sizeLimitPercentage)
@@ -93,7 +93,7 @@ struct CachePruner
         this.expireDuration = dur!"seconds"(expireIntervalSeconds);
         this.sizeLimit = sizeLimit;
         this.sizeLimitPercentage = sizeLimitPercentage < 100 ? sizeLimitPercentage : 100;
-        this.willPruneForSize = sizeLimit > 0;
+        this.willPruneForSize = (sizeLimit > 0) || (sizeLimitPercentage < 100);
     }
 
     void doPrune()
@@ -150,7 +150,7 @@ private:
 
     void pruneForSize(DirEntry[] candidates, ulong cacheSize)
     {
-        ulong availableSpace = getAvailableDiskSpace(cachePath);
+        ulong availableSpace = cacheSize + getAvailableDiskSpace(cachePath);
         if (!isSizeAboveMaximum(cacheSize, availableSpace))
             return;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git



More information about the pkg-d-commits mailing list