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.
master
poornas 5 years ago committed by kannappanr
parent e6ce9da087
commit 04de3ea4bd
  1. 4
      cmd/disk-cache-backend.go

@ -220,10 +220,10 @@ func (c *diskCache) purge() {
} }
ctx := context.Background() ctx := context.Background()
for { for {
olderThan := c.expiry olderThan := c.expiry * 24
for !c.diskUsageLow() { for !c.diskUsageLow() {
// delete unaccessed objects older than expiry duration // 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 olderThan /= 2
if olderThan < 1 { if olderThan < 1 {
break break

Loading…
Cancel
Save