Browse Source

#1943 Able to config fsck timeout

pull/2133/head
Unknwon 9 years ago
parent
commit
718d3ae258
  1. 2
      README.md
  2. 1
      conf/app.ini
  3. 2
      gogs.go
  4. 4
      models/repo.go
  5. 4
      modules/bindata/bindata.go
  6. 1
      modules/setting/setting.go
  7. 2
      templates/.VERSION

2
README.md

@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](public/img/gogs-large-resize.png) ![](public/img/gogs-large-resize.png)
##### Current version: 0.7.35 Beta ##### Current version: 0.7.36 Beta
| Web | UI | Preview | | Web | UI | Preview |
|:-------------:|:-------:|:-------:| |:-------------:|:-------:|:-------:|

1
conf/app.ini

@ -296,6 +296,7 @@ SCHEDULE = @every 1h
; Repository health check ; Repository health check
[cron.repo_health_check] [cron.repo_health_check]
SCHEDULE = @every 24h SCHEDULE = @every 24h
TIMEOUT = 60s
; Arguments for command 'git fsck', e.g.: "--unreachable --tags" ; Arguments for command 'git fsck', e.g.: "--unreachable --tags"
; see more on http://git-scm.com/docs/git-fsck/1.7.5 ; see more on http://git-scm.com/docs/git-fsck/1.7.5
ARGS = ARGS =

2
gogs.go

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.7.35.1209 Beta" const APP_VER = "0.7.36.1209 Beta"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

4
models/repo.go

@ -1583,13 +1583,11 @@ func GitFsck() {
log.Trace("Doing: GitFsck") log.Trace("Doing: GitFsck")
args := append([]string{"fsck"}, setting.Cron.RepoHealthCheck.Args...)
if err := x.Where("id>0").Iterate(new(Repository), if err := x.Where("id>0").Iterate(new(Repository),
func(idx int, bean interface{}) error { func(idx int, bean interface{}) error {
repo := bean.(*Repository) repo := bean.(*Repository)
repoPath := repo.RepoPath() repoPath := repo.RepoPath()
_, _, err := process.ExecDir(-1, repoPath, "Repository health check", "git", args...) if err := git.Fsck(repoPath, setting.Cron.RepoHealthCheck.Timeout, setting.Cron.RepoHealthCheck.Args...); err != nil {
if err != nil {
desc := fmt.Sprintf("Fail to health check repository(%s)", repoPath) desc := fmt.Sprintf("Fail to health check repository(%s)", repoPath)
log.Warn(desc) log.Warn(desc)
if err = CreateRepositoryNotice(desc); err != nil { if err = CreateRepositoryNotice(desc); err != nil {

4
modules/bindata/bindata.go

File diff suppressed because one or more lines are too long

1
modules/setting/setting.go

@ -162,6 +162,7 @@ var (
Enabled bool Enabled bool
RunAtStart bool RunAtStart bool
Schedule string Schedule string
Timeout time.Duration
Args []string `delim:" "` Args []string `delim:" "`
} `ini:"cron.repo_health_check"` } `ini:"cron.repo_health_check"`
CheckRepoStats struct { CheckRepoStats struct {

2
templates/.VERSION

@ -1 +1 @@
0.7.35.1209 Beta 0.7.36.1209 Beta
Loading…
Cancel
Save