diff options
author | Lanre Adelowo <adelowomailbox@gmail.com> | 2018-08-23 07:15:07 +0100 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2018-08-23 14:15:07 +0800 |
commit | 33bc2ebdfac28c9b83dfd0aab8ee8cb0d45ef927 (patch) | |
tree | 4cd8418fbb6f7875f725302f80e6c86466a9ee7e /models/repo_mirror.go | |
parent | 6ca8fbd2f94a1a02e1776a1d62ad2fb897839e47 (diff) | |
download | gitea-33bc2ebdfac28c9b83dfd0aab8ee8cb0d45ef927.tar.gz gitea-33bc2ebdfac28c9b83dfd0aab8ee8cb0d45ef927.zip |
Make sure to reset commit count in the cache on mirror syncing (#4720)
* Make sure to reset commit count in the cache on mirror syncing
* reset count of commits in all branches
Diffstat (limited to 'models/repo_mirror.go')
-rw-r--r-- | models/repo_mirror.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/models/repo_mirror.go b/models/repo_mirror.go index 97fe2406c6..1431fcf916 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 } |