// Copyright 2019 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package setting
import (
"time"
"code.gitea.io/gitea/modules/log"
)
var (
// Cron tasks
Cron = struct {
UpdateMirror struct {
Enabled bool
RunAtStart bool
Schedule string
} `ini:"cron.update_mirrors"`
RepoHealthCheck struct {
Timeout time.Duration
Args []string `delim:" "`
} `ini:"cron.repo_health_check"`
CheckRepoStats struct {
} `ini:"cron.check_repo_stats"`
ArchiveCleanup struct {
OlderThan time.Duration
} `ini:"cron.archive_cleanup"`
SyncExternalUsers struct {
UpdateExisting bool
} `ini:"cron.sync_external_users"`
DeletedBranchesCleanup struct {
} `ini:"cron.deleted_branches_cleanup"`
UpdateMigrationPosterID struct {
} `ini:"cron.update_migration_poster_id"`
}{
UpdateMirror: struct {
Enabled: true,
RunAtStart: false,
Schedule: "@every 10m",
},
RepoHealthCheck: struct {
Schedule: "@every 24h",
Timeout: 60 * time.Second,
Args: []string{},
CheckRepoStats: struct {
RunAtStart: true,
ArchiveCleanup: struct {
OlderThan: 24 * time.Hour,
SyncExternalUsers: struct {
UpdateExisting: true,
DeletedBranchesCleanup: struct {
UpdateMigrationPosterID: struct {
}
func newCron() {
if err := Cfg.Section("cron").MapTo(&Cron); err != nil {
log.Fatal("Failed to map Cron settings: %v", err)