summaryrefslogtreecommitdiffstats
path: root/modules/git/last_commit_cache_gogit.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-02-09 22:29:03 +0000
committerGitHub <noreply@github.com>2021-02-09 22:29:03 +0000
commit30f7ddb833adfe276a93c1a79e243b8d33bdd41e (patch)
tree923227416de1d00b9158a43e64dcb0ceac2d5023 /modules/git/last_commit_cache_gogit.go
parent3a4801d1958ce33c9b893433c096281aa5b9b1c5 (diff)
downloadgitea-30f7ddb833adfe276a93c1a79e243b8d33bdd41e.tar.gz
gitea-30f7ddb833adfe276a93c1a79e243b8d33bdd41e.zip
Ensure memcache TTL cannot be over 30 days (#14592)
Memcached TTL cannot be > 30 days and if it is attempted the TTL is interpreted as a unix timestamp. This PR ensures that the TTL is switched to a unix timestamp in those cases. Fix #14571 Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/git/last_commit_cache_gogit.go')
-rw-r--r--modules/git/last_commit_cache_gogit.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/git/last_commit_cache_gogit.go b/modules/git/last_commit_cache_gogit.go
index 76c97a4cc0..65d6299bef 100644
--- a/modules/git/last_commit_cache_gogit.go
+++ b/modules/git/last_commit_cache_gogit.go
@@ -16,14 +16,14 @@ import (
// LastCommitCache represents a cache to store last commit
type LastCommitCache struct {
repoPath string
- ttl int64
+ ttl func() int64
repo *Repository
commitCache map[string]*object.Commit
cache Cache
}
// NewLastCommitCache creates a new last commit cache for repo
-func NewLastCommitCache(repoPath string, gitRepo *Repository, ttl int64, cache Cache) *LastCommitCache {
+func NewLastCommitCache(repoPath string, gitRepo *Repository, ttl func() int64, cache Cache) *LastCommitCache {
if cache == nil {
return nil
}