Skip to content

Commit

Permalink
Make sure to reset commit count in the cache on mirror syncing (#4720) (
Browse files Browse the repository at this point in the history
#4770)

* Make sure to reset commit count in the cache on mirror syncing

* reset count of commits in all branches
  • Loading branch information
adelowo authored and lunny committed Aug 23, 2018
1 parent e9def84 commit 3fbcdd9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions models/repo_mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 3fbcdd9

Please sign in to comment.