aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo_mirror.go
diff options
context:
space:
mode:
authorLanre Adelowo <adelowomailbox@gmail.com>2018-08-23 07:15:07 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2018-08-23 14:15:07 +0800
commit33bc2ebdfac28c9b83dfd0aab8ee8cb0d45ef927 (patch)
tree4cd8418fbb6f7875f725302f80e6c86466a9ee7e /models/repo_mirror.go
parent6ca8fbd2f94a1a02e1776a1d62ad2fb897839e47 (diff)
downloadgitea-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.go11
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
}