aboutsummaryrefslogtreecommitdiffhomepage
path: root/cache
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2022-05-09 10:05:19 +0200
committerBjørn Erik Pedersen <[email protected]>2022-05-09 14:18:40 +0200
commit51f08b0b6aae175299b4e73d521343a4386a9cf7 (patch)
tree6966bc277671a1f62e9363a2a16fa7a2d6ccacd1 /cache
parent860c51c314e1f2b06b1424a3b277a2db96fc1f04 (diff)
downloadhugo-51f08b0b6aae175299b4e73d521343a4386a9cf7.tar.gz
hugo-51f08b0b6aae175299b4e73d521343a4386a9cf7.zip
Revise the use of htime.Since/htime.Now
We cannot (also, it doesn't add any value) use that when the `clock` is set, * To measure time (before that global is set) * To compare file timestamps re cache eviction Fixes #9868
Diffstat (limited to 'cache')
-rw-r--r--cache/filecache/filecache.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/cache/filecache/filecache.go b/cache/filecache/filecache.go
index 3104d8ac6..63d939ef6 100644
--- a/cache/filecache/filecache.go
+++ b/cache/filecache/filecache.go
@@ -24,7 +24,6 @@ import (
"sync"
"time"
- "github.com/gohugoio/hugo/common/htime"
"github.com/gohugoio/hugo/common/hugio"
"github.com/gohugoio/hugo/helpers"
@@ -296,7 +295,10 @@ func (c *Cache) isExpired(modTime time.Time) bool {
if c.maxAge < 0 {
return false
}
- return c.maxAge == 0 || htime.Since(modTime) > c.maxAge
+
+ // Note the use of time.Since here.
+ // We cannot use Hugo's global Clock for this.
+ return c.maxAge == 0 || time.Since(modTime) > c.maxAge
}
// For testing