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:
committed by
techknowlogick
parent
760c473896
commit
d2958d9f46
@@ -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{
|
||||
|
Reference in New Issue
Block a user