1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Move status table to cron package (#7370)

This commit is contained in:
Lunny Xiao
2019-07-16 08:13:03 +08:00
committed by techknowlogick
parent 760c473896
commit d2958d9f46
24 changed files with 687 additions and 501 deletions

View File

@@ -2056,11 +2056,6 @@ func DeleteRepositoryArchives() error {
// DeleteOldRepositoryArchives deletes old repository archives.
func DeleteOldRepositoryArchives() {
if !taskStatusTable.StartIfNotRunning(archiveCleanup) {
return
}
defer taskStatusTable.Stop(archiveCleanup)
log.Trace("Doing: ArchiveCleanup")
if err := x.Where("id > 0").Iterate(new(Repository), deleteOldRepositoryArchives); err != nil {
@@ -2187,23 +2182,8 @@ func SyncRepositoryHooks() error {
})
}
// Prevent duplicate running tasks.
var taskStatusTable = sync.NewStatusTable()
const (
mirrorUpdate = "mirror_update"
gitFsck = "git_fsck"
checkRepos = "check_repos"
archiveCleanup = "archive_cleanup"
)
// GitFsck calls 'git fsck' to check repository health.
func GitFsck() {
if !taskStatusTable.StartIfNotRunning(gitFsck) {
return
}
defer taskStatusTable.Stop(gitFsck)
log.Trace("Doing: GitFsck")
if err := x.
@@ -2272,11 +2252,6 @@ func repoStatsCheck(checker *repoChecker) {
// CheckRepoStats checks the repository stats
func CheckRepoStats() {
if !taskStatusTable.StartIfNotRunning(checkRepos) {
return
}
defer taskStatusTable.Stop(checkRepos)
log.Trace("Doing: CheckRepoStats")
checkers := []*repoChecker{