You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

timer.go 411 B

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
12345678910111213141516171819202122232425262728293031
  1. package timer
  2. import (
  3. "github.com/robfig/cron/v3"
  4. //"time"
  5. "code.gitea.io/gitea/routers/repo"
  6. )
  7. /*
  8. const (
  9. DecompressTimer = time.Minute * 10
  10. )
  11. */
  12. func init() {
  13. /*
  14. tiker := time.NewTicker(DecompressTimer)
  15. go func() {
  16. for {
  17. <-ticker.C
  18. repo.HandleUnDecompressAttachment()
  19. }
  20. }()
  21. */
  22. c := cron.New()
  23. spec := "*/10 * * * *"
  24. c.AddFunc(spec, repo.HandleUnDecompressAttachment)
  25. c.Start()
  26. }