manager.go 629 B

1234567891011121314151617181920212223242526
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package cron
  5. import (
  6. "fmt"
  7. "github.com/gogits/gogs/models"
  8. "github.com/gogits/gogs/modules/setting"
  9. )
  10. var c = New()
  11. func NewCronContext() {
  12. models.GitFsck()
  13. c.AddFunc("Update mirrors", "@every 1h", models.MirrorUpdate)
  14. c.AddFunc("Deliver hooks", fmt.Sprintf("@every %dm", setting.WebhookTaskInterval), models.DeliverHooks)
  15. c.AddFunc("Repository health check", "@every 1h", models.GitFsck)
  16. c.Start()
  17. }
  18. func ListEntries() []*Entry {
  19. return c.Entries()
  20. }