summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-07-16 08:13:03 +0800
committertechknowlogick <techknowlogick@gitea.io>2019-07-15 20:13:03 -0400
commitd2958d9f4633ddbde2202952d665b3d562eb0415 (patch)
tree59f6d1c0ed6c886ba0caa6d96d5a175debf376b7 /models
parent760c47389696e97131a3d13629a0a5a4576e5283 (diff)
downloadgitea-d2958d9f4633ddbde2202952d665b3d562eb0415.tar.gz
gitea-d2958d9f4633ddbde2202952d665b3d562eb0415.zip
Move status table to cron package (#7370)
Diffstat (limited to 'models')
-rw-r--r--models/branches.go5
-rw-r--r--models/repo.go25
-rw-r--r--models/repo_mirror.go5
-rw-r--r--models/user.go7
4 files changed, 0 insertions, 42 deletions
diff --git a/models/branches.go b/models/branches.go
index fa4215d6a0..c09e72e988 100644
--- a/models/branches.go
+++ b/models/branches.go
@@ -458,11 +458,6 @@ func (deletedBranch *DeletedBranch) LoadUser() {
// RemoveOldDeletedBranches removes old deleted branches
func RemoveOldDeletedBranches() {
- if !taskStatusTable.StartIfNotRunning(`deleted_branches_cleanup`) {
- return
- }
- defer taskStatusTable.Stop(`deleted_branches_cleanup`)
-
log.Trace("Doing: DeletedBranchesCleanup")
deleteBefore := time.Now().Add(-setting.Cron.DeletedBranchesCleanup.OlderThan)
diff --git a/models/repo.go b/models/repo.go
index 9bedeba952..fc5f81eb5c 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -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{
diff --git a/models/repo_mirror.go b/models/repo_mirror.go
index c62834f6fb..528e9daa8b 100644
--- a/models/repo_mirror.go
+++ b/models/repo_mirror.go
@@ -315,11 +315,6 @@ func DeleteMirrorByRepoID(repoID int64) error {
// MirrorUpdate checks and updates mirror repositories.
func MirrorUpdate() {
- if !taskStatusTable.StartIfNotRunning(mirrorUpdate) {
- return
- }
- defer taskStatusTable.Stop(mirrorUpdate)
-
log.Trace("Doing: MirrorUpdate")
if err := x.
diff --git a/models/user.go b/models/user.go
index fc0dfee187..1d80f7836a 100644
--- a/models/user.go
+++ b/models/user.go
@@ -60,8 +60,6 @@ const (
algoPbkdf2 = "pbkdf2"
)
-const syncExternalUsers = "sync_external_users"
-
var (
// ErrUserNotKeyOwner user does not own this key error
ErrUserNotKeyOwner = errors.New("User does not own this public key")
@@ -1643,11 +1641,6 @@ func synchronizeLdapSSHPublicKeys(usr *User, s *LoginSource, sshPublicKeys []str
// SyncExternalUsers is used to synchronize users with external authorization source
func SyncExternalUsers() {
- if !taskStatusTable.StartIfNotRunning(syncExternalUsers) {
- return
- }
- defer taskStatusTable.Stop(syncExternalUsers)
-
log.Trace("Doing: SyncExternalUsers")
ls, err := LoginSources()