mirror of
1
Fork 0
This commit is contained in:
Unknwon 2015-01-02 13:30:45 +08:00
parent 677b1ec627
commit 0b56272c13
5 changed files with 21 additions and 7 deletions

View File

@ -7,7 +7,7 @@ Gogs(Go Git Service) is a painless self-hosted Git Service written in Go.
![Demo](https://gowalker.org/public/gogs_demo.gif) ![Demo](https://gowalker.org/public/gogs_demo.gif)
##### Current version: 0.5.9 Beta ##### Current version: 0.5.11 Beta
### NOTICES ### NOTICES

View File

@ -5,7 +5,7 @@ Gogs(Go Git Service) 是一个基于 Go 语言的自助 Git 服务。
![Demo](https://gowalker.org/public/gogs_demo.gif) ![Demo](https://gowalker.org/public/gogs_demo.gif)
##### 当前版本0.5.9 Beta ##### 当前版本0.5.11 Beta
## 开发目的 ## 开发目的

View File

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

View File

@ -1186,6 +1186,8 @@ func MirrorUpdate() {
isMirrorUpdating = true isMirrorUpdating = true
defer func() { isMirrorUpdating = false }() defer func() { isMirrorUpdating = false }()
mirrors := make([]*Mirror, 0, 10)
if err := x.Iterate(new(Mirror), func(idx int, bean interface{}) error { if err := x.Iterate(new(Mirror), func(idx int, bean interface{}) error {
m := bean.(*Mirror) m := bean.(*Mirror)
if m.NextUpdate.After(time.Now()) { if m.NextUpdate.After(time.Now()) {
@ -1196,13 +1198,25 @@ func MirrorUpdate() {
if _, stderr, err := process.ExecDir(10*time.Minute, if _, stderr, err := process.ExecDir(10*time.Minute,
repoPath, fmt.Sprintf("MirrorUpdate: %s", repoPath), repoPath, fmt.Sprintf("MirrorUpdate: %s", repoPath),
"git", "remote", "update"); err != nil { "git", "remote", "update"); err != nil {
return errors.New("git remote update: " + stderr) desc := fmt.Sprintf("Fail to update mirror repository(%s): %s", repoPath, stderr)
log.Error(4, desc)
if err = CreateRepositoryNotice(desc); err != nil {
log.Error(4, "Fail to add notice: %v", err)
}
return nil
} }
m.NextUpdate = time.Now().Add(time.Duration(m.Interval) * time.Hour) m.NextUpdate = time.Now().Add(time.Duration(m.Interval) * time.Hour)
return UpdateMirror(m) mirrors = append(mirrors, m)
return nil
}); err != nil { }); err != nil {
log.Error(4, "repo.MirrorUpdate: %v", err) log.Error(4, "MirrorUpdate: %v", err)
}
for i := range mirrors {
if err := UpdateMirror(mirrors[i]); err != nil {
log.Error(4, "UpdateMirror", fmt.Sprintf("%s: %v", mirrors[i].RepoName, err))
}
} }
} }

View File

@ -1 +1 @@
0.5.10.0102 Beta 0.5.11.0102 Beta