Skip to content

Commit 33bc2eb

Browse files
adelowolunny
authored andcommitted
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
1 parent 6ca8fbd commit 33bc2eb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

models/repo_mirror.go

+11
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"time"
1010

1111
"code.gitea.io/git"
12+
"code.gitea.io/gitea/modules/cache"
1213
"code.gitea.io/gitea/modules/log"
1314
"code.gitea.io/gitea/modules/process"
1415
"code.gitea.io/gitea/modules/setting"
@@ -180,6 +181,16 @@ func (m *Mirror) runSync() bool {
180181
}
181182
}
182183

184+
branches, err := m.Repo.GetBranches()
185+
if err != nil {
186+
log.Error(4, "GetBranches: %v", err)
187+
return false
188+
}
189+
190+
for i := range branches {
191+
cache.Remove(m.Repo.GetCommitsCountCacheKey(branches[i].Name, true))
192+
}
193+
183194
m.UpdatedUnix = util.TimeStampNow()
184195
return true
185196
}

0 commit comments

Comments
 (0)