Change cache purge routine granularity to hours (#8660)

With this PR,cache eviction will continue until
no LRU entries older than an hour can be cache
evicted or sufficient percentage of disk space
has been reclaimed.
This commit is contained in:
poornas 2019-12-18 13:49:10 -08:00 committed by kannappanr
parent e6ce9da087
commit 04de3ea4bd

View file

@ -220,10 +220,10 @@ func (c *diskCache) purge() {
}
ctx := context.Background()
for {
olderThan := c.expiry
olderThan := c.expiry * 24
for !c.diskUsageLow() {
// delete unaccessed objects older than expiry duration
expiry := UTCNow().AddDate(0, 0, -1*olderThan)
expiry := UTCNow().Add(time.Hour * time.Duration(-1*olderThan))
olderThan /= 2
if olderThan < 1 {
break