diff options
author | Andrew <write@imaginarycode.com> | 2017-02-10 23:00:46 -0500 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-02-11 12:00:46 +0800 |
commit | 42835c7f82ac379d5d583fa8406cff529b9d0e9e (patch) | |
tree | 87dc278aa0261a93b65bd06a39db7688f030a288 /modules/cron | |
parent | cf0f451c37496c84795e98191a20350e0f5be35c (diff) | |
download | gitea-42835c7f82ac379d5d583fa8406cff529b9d0e9e.tar.gz gitea-42835c7f82ac379d5d583fa8406cff529b9d0e9e.zip |
Implement archive cleanup (#885)
* Implement archive cleanup
Fixes #769
Signed-off-by: Andrew <write@imaginarycode.com>
* Make sure to close the directory file
* Resolve issues noted by @strk
* edit cheatsheet app.ini [ci skip]
* oops [ci skip]
Diffstat (limited to 'modules/cron')
-rw-r--r-- | modules/cron/cron.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/cron/cron.go b/modules/cron/cron.go index e1110d787b..785bf44ada 100644 --- a/modules/cron/cron.go +++ b/modules/cron/cron.go @@ -55,6 +55,17 @@ func NewContext() { go models.CheckRepoStats() } } + if setting.Cron.ArchiveCleanup.Enabled { + entry, err = c.AddFunc("Clean up old repository archives", setting.Cron.ArchiveCleanup.Schedule, models.DeleteOldRepositoryArchives) + if err != nil { + log.Fatal(4, "Cron[Clean up old repository archives]: %v", err) + } + if setting.Cron.ArchiveCleanup.RunAtStart { + entry.Prev = time.Now() + entry.ExecTimes++ + go models.DeleteOldRepositoryArchives() + } + } c.Start() } |