mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-21 12:44:49 -05:00
#1943 Able to config fsck timeout
This commit is contained in:
parent
b8d48bdb62
commit
718d3ae258
7 changed files with 8 additions and 8 deletions
|
@ -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 |
|
||||||
|:-------------:|:-------:|:-------:|
|
|:-------------:|:-------:|:-------:|
|
||||||
|
|
|
@ -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
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())
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -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 {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.7.35.1209 Beta
|
0.7.36.1209 Beta
|
Loading…
Reference in a new issue