mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	#1943 Able to config fsck timeout
This commit is contained in:
		@@ -5,7 +5,7 @@ Gogs - Go Git Service [
 | 
			
		||||
 | 
			
		||||
##### Current version: 0.7.35 Beta
 | 
			
		||||
##### Current version: 0.7.36 Beta
 | 
			
		||||
 | 
			
		||||
| Web | UI  | Preview  |
 | 
			
		||||
|:-------------:|:-------:|:-------:|
 | 
			
		||||
 
 | 
			
		||||
@@ -296,6 +296,7 @@ SCHEDULE = @every 1h
 | 
			
		||||
; Repository health check
 | 
			
		||||
[cron.repo_health_check]
 | 
			
		||||
SCHEDULE = @every 24h
 | 
			
		||||
TIMEOUT = 60s
 | 
			
		||||
; Arguments for command 'git fsck', e.g.: "--unreachable --tags"
 | 
			
		||||
; see more on http://git-scm.com/docs/git-fsck/1.7.5
 | 
			
		||||
ARGS = 
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							@@ -17,7 +17,7 @@ import (
 | 
			
		||||
	"github.com/gogits/gogs/modules/setting"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const APP_VER = "0.7.35.1209 Beta"
 | 
			
		||||
const APP_VER = "0.7.36.1209 Beta"
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
	runtime.GOMAXPROCS(runtime.NumCPU())
 | 
			
		||||
 
 | 
			
		||||
@@ -1583,13 +1583,11 @@ func GitFsck() {
 | 
			
		||||
 | 
			
		||||
	log.Trace("Doing: GitFsck")
 | 
			
		||||
 | 
			
		||||
	args := append([]string{"fsck"}, setting.Cron.RepoHealthCheck.Args...)
 | 
			
		||||
	if err := x.Where("id>0").Iterate(new(Repository),
 | 
			
		||||
		func(idx int, bean interface{}) error {
 | 
			
		||||
			repo := bean.(*Repository)
 | 
			
		||||
			repoPath := repo.RepoPath()
 | 
			
		||||
			_, _, err := process.ExecDir(-1, repoPath, "Repository health check", "git", args...)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
			if err := git.Fsck(repoPath, setting.Cron.RepoHealthCheck.Timeout, setting.Cron.RepoHealthCheck.Args...); err != nil {
 | 
			
		||||
				desc := fmt.Sprintf("Fail to health check repository(%s)", repoPath)
 | 
			
		||||
				log.Warn(desc)
 | 
			
		||||
				if err = CreateRepositoryNotice(desc); err != nil {
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -162,6 +162,7 @@ var (
 | 
			
		||||
			Enabled    bool
 | 
			
		||||
			RunAtStart bool
 | 
			
		||||
			Schedule   string
 | 
			
		||||
			Timeout    time.Duration
 | 
			
		||||
			Args       []string `delim:" "`
 | 
			
		||||
		} `ini:"cron.repo_health_check"`
 | 
			
		||||
		CheckRepoStats struct {
 | 
			
		||||
 
 | 
			
		||||
@@ -1 +1 @@
 | 
			
		||||
0.7.35.1209 Beta
 | 
			
		||||
0.7.36.1209 Beta
 | 
			
		||||
		Reference in New Issue
	
	Block a user