From 3fbcdd9e25ece76802dce21087e5329352bf9cfa Mon Sep 17 00:00:00 2001 From: Lanre Adelowo Date: Thu, 23 Aug 2018 15:23:21 +0100 Subject: [PATCH] Make sure to reset commit count in the cache on mirror syncing (#4720) (#4770) * Make sure to reset commit count in the cache on mirror syncing * reset count of commits in all branches --- models/repo_mirror.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/models/repo_mirror.go b/models/repo_mirror.go index 97fe2406c..1431fcf91 100644 --- a/models/repo_mirror.go +++ b/models/repo_mirror.go @@ -9,6 +9,7 @@ import ( "time" "code.gitea.io/git" + "code.gitea.io/gitea/modules/cache" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/process" "code.gitea.io/gitea/modules/setting" @@ -180,6 +181,16 @@ func (m *Mirror) runSync() bool { } } + branches, err := m.Repo.GetBranches() + if err != nil { + log.Error(4, "GetBranches: %v", err) + return false + } + + for i := range branches { + cache.Remove(m.Repo.GetCommitsCountCacheKey(branches[i].Name, true)) + } + m.UpdatedUnix = util.TimeStampNow() return true }