parent
d17f102339
commit
b1696665bd
@ -0,0 +1,40 @@
|
||||
// Copyright 2014 The Gogs 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 cron
|
||||
|
||||
import (
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/cron"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
var c = cron.New()
|
||||
|
||||
func NewCronContext() {
|
||||
if setting.Cron.UpdateMirror.Enabled {
|
||||
c.AddFunc("Update mirrors", setting.Cron.UpdateMirror.Schedule, models.MirrorUpdate)
|
||||
if setting.Cron.UpdateMirror.RunAtStart {
|
||||
go models.MirrorUpdate()
|
||||
}
|
||||
}
|
||||
if setting.Cron.RepoHealthCheck.Enabled {
|
||||
c.AddFunc("Repository health check", setting.Cron.RepoHealthCheck.Schedule, models.GitFsck)
|
||||
if setting.Cron.RepoHealthCheck.RunAtStart {
|
||||
go models.GitFsck()
|
||||
}
|
||||
}
|
||||
if setting.Cron.CheckRepoStats.Enabled {
|
||||
c.AddFunc("Check repository statistics", setting.Cron.CheckRepoStats.Schedule, models.CheckRepoStats)
|
||||
if setting.Cron.CheckRepoStats.RunAtStart {
|
||||
go models.CheckRepoStats()
|
||||
}
|
||||
}
|
||||
c.Start()
|
||||
}
|
||||
|
||||
// ListTasks returns all running cron tasks.
|
||||
func ListTasks() []*cron.Entry {
|
||||
return c.Entries()
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -1,27 +0,0 @@
|
||||
// Copyright 2014 The Gogs 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 cron
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
var c = New()
|
||||
|
||||
func NewCronContext() {
|
||||
c.AddFunc("Update mirrors", "@every 1h", models.MirrorUpdate)
|
||||
if setting.Git.Fsck.Enable {
|
||||
c.AddFunc("Repository health check", fmt.Sprintf("@every %dh", setting.Git.Fsck.Interval), models.GitFsck)
|
||||
}
|
||||
c.AddFunc("Check repository statistics", "@every 24h", models.CheckRepoStats)
|
||||
c.Start()
|
||||
}
|
||||
|
||||
func ListEntries() []*Entry {
|
||||
return c.Entries()
|
||||
}
|
@ -1 +1 @@
|
||||
0.6.5.0817 Beta
|
||||
0.6.5.0818 Beta
|
Loading…
Reference in new issue