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
This commit is contained in:
Lanre Adelowo 2018-08-23 15:23:21 +01:00 committed by Lunny Xiao
parent e9def84bf2
commit 3fbcdd9e25
1 changed files with 11 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import (
"time" "time"
"code.gitea.io/git" "code.gitea.io/git"
"code.gitea.io/gitea/modules/cache"
"code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/process" "code.gitea.io/gitea/modules/process"
"code.gitea.io/gitea/modules/setting" "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() m.UpdatedUnix = util.TimeStampNow()
return true return true
} }