forked from forgejo/forgejo
#1943 Able to config fsck timeout
This commit is contained in:
parent
b8d48bdb62
commit
718d3ae258
7 changed files with 8 additions and 8 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue