cron.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. "time"
  7. log "gopkg.in/clog.v1"
  8. "github.com/gogs/cron"
  9. "github.com/gogs/gogs/models"
  10. "github.com/gogs/gogs/pkg/setting"
  11. )
  12. var c = cron.New()
  13. func NewContext() {
  14. var (
  15. entry *cron.Entry
  16. err error
  17. )
  18. if setting.Cron.UpdateMirror.Enabled {
  19. entry, err = c.AddFunc("Update mirrors", setting.Cron.UpdateMirror.Schedule, models.MirrorUpdate)
  20. if err != nil {
  21. log.Fatal(2, "Cron.(update mirrors): %v", err)
  22. }
  23. if setting.Cron.UpdateMirror.RunAtStart {
  24. entry.Prev = time.Now()
  25. entry.ExecTimes++
  26. go models.MirrorUpdate()
  27. }
  28. }
  29. if setting.Cron.RepoHealthCheck.Enabled {
  30. entry, err = c.AddFunc("Repository health check", setting.Cron.RepoHealthCheck.Schedule, models.GitFsck)
  31. if err != nil {
  32. log.Fatal(2, "Cron.(repository health check): %v", err)
  33. }
  34. if setting.Cron.RepoHealthCheck.RunAtStart {
  35. entry.Prev = time.Now()
  36. entry.ExecTimes++
  37. go models.GitFsck()
  38. }
  39. }
  40. if setting.Cron.CheckRepoStats.Enabled {
  41. entry, err = c.AddFunc("Check repository statistics", setting.Cron.CheckRepoStats.Schedule, models.CheckRepoStats)
  42. if err != nil {
  43. log.Fatal(2, "Cron.(check repository statistics): %v", err)
  44. }
  45. if setting.Cron.CheckRepoStats.RunAtStart {
  46. entry.Prev = time.Now()
  47. entry.ExecTimes++
  48. go models.CheckRepoStats()
  49. }
  50. }
  51. if setting.Cron.RepoArchiveCleanup.Enabled {
  52. entry, err = c.AddFunc("Repository archive cleanup", setting.Cron.RepoArchiveCleanup.Schedule, models.DeleteOldRepositoryArchives)
  53. if err != nil {
  54. log.Fatal(2, "Cron.(repository archive cleanup): %v", err)
  55. }
  56. if setting.Cron.RepoArchiveCleanup.RunAtStart {
  57. entry.Prev = time.Now()
  58. entry.ExecTimes++
  59. go models.DeleteOldRepositoryArchives()
  60. }
  61. }
  62. c.Start()
  63. }
  64. // ListTasks returns all running cron tasks.
  65. func ListTasks() []*cron.Entry {
  66. return c.Entries()
  67. }
PANIC: session(release): write data/sessions/2/c/2ceadc80c52a8b37: no space left on device

PANIC

session(release): write data/sessions/2/c/2ceadc80c52a8b37: no space left on device
github.com/go-macaron/session@v0.0.0-20190805070824-1a3cdc6f5659/session.go:199 (0x8b2934)
gopkg.in/macaron.v1@v1.3.9/context.go:79 (0x83d0a0)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/context.go:112 (0x84fdb5)
gopkg.in/macaron.v1@v1.3.9/recovery.go:161 (0x84fda8)
gopkg.in/macaron.v1@v1.3.9/logger.go:40 (0x840c73)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/router.go:187 (0x850fc6)
gopkg.in/macaron.v1@v1.3.9/router.go:303 (0x8493e5)
gopkg.in/macaron.v1@v1.3.9/macaron.go:220 (0x841fca)
net/http/server.go:2836 (0x7a79b2)
net/http/server.go:1924 (0x7a341b)
runtime/asm_amd64.s:1373 (0x46f9f0)