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

make cron task configurable

This commit is contained in:
Unknwon
2015-08-18 02:19:29 +08:00
parent d17f102339
commit b1696665bd
10 changed files with 123 additions and 80 deletions

View File

@@ -1108,7 +1108,7 @@ func RewriteRepositoryUpdateHook() error {
}
var (
// Prevent duplicate tasks.
// Prevent duplicate running tasks.
isMirrorUpdating = false
isGitFscking = false
isCheckingRepos = false
@@ -1164,7 +1164,7 @@ func GitFsck() {
isGitFscking = true
defer func() { isGitFscking = false }()
args := append([]string{"fsck"}, setting.Git.Fsck.Args...)
args := append([]string{"fsck"}, setting.Cron.RepoHealthCheck.Args...)
if err := x.Where("id > 0").Iterate(new(Repository),
func(idx int, bean interface{}) error {
repo := bean.(*Repository)
@@ -1216,7 +1216,7 @@ func CheckRepoStats() {
log.Error(4, "select repository check 'watch': %v", err)
}
for _, repo_id := range results_watch {
log.Info("updating repository count 'watch'")
log.Trace("updating repository count 'watch'")
repoID := com.StrTo(repo_id["id"]).MustInt64()
_, err := x.Exec("UPDATE `repository` SET num_watches=(SELECT count(*) FROM `watch` WHERE repo_id=?) WHERE id=?", repoID, repoID)
if err != nil {
@@ -1230,7 +1230,7 @@ func CheckRepoStats() {
log.Error(4, "select repository check 'star': %v", err)
}
for _, repo_id := range results_star {
log.Info("updating repository count 'star'")
log.Trace("updating repository count 'star'")
repoID := com.StrTo(repo_id["id"]).MustInt64()
_, err := x.Exec("UPDATE `repository` SET .num_stars=(SELECT count(*) FROM `star` WHERE repo_id=?) WHERE id=?", repoID, repoID)
if err != nil {