This commit is contained in:
6543 2021-12-05 15:53:46 +01:00
parent 76c867cfca
commit de4706bf58
No known key found for this signature in database
GPG key ID: C99B82E40B027BAE
6 changed files with 21 additions and 20 deletions

View file

@ -5,6 +5,8 @@ import (
"github.com/valyala/fasthttp"
"github.com/valyala/fastjson"
"codeberg.org/codeberg/pages/server/cache"
)
type branchTimestamp struct {
@ -14,7 +16,7 @@ type branchTimestamp struct {
// GetBranchTimestamp finds the default branch (if branch is "") and returns the last modification time of the branch
// (or nil if the branch doesn't exist)
func GetBranchTimestamp(owner, repo, branch, giteaRoot, giteaApiToken string) *branchTimestamp {
func GetBranchTimestamp(owner, repo, branch, giteaRoot, giteaApiToken string, branchTimestampCache cache.SetGetKey) *branchTimestamp {
if result, ok := branchTimestampCache.Get(owner + "/" + repo + "/" + branch); ok {
if result == nil {
return nil