Skip to content

Commit

Permalink
加大重试力度
Browse files Browse the repository at this point in the history
  • Loading branch information
movsb committed Dec 10, 2024
1 parent 5011f7a commit 70704e7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cmd/sync/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func New(config client.HostConfig, credential Credential, root string, full bool

// 内部会自动大量重试因为网络问题导致的错误。
func (g *GitSync) Sync() error {
const MaxRetry = 10
const MaxRetry = 20

repo, tree, err := g.prepare()
if err != nil {
Expand Down Expand Up @@ -172,8 +172,7 @@ func (g *GitSync) push(repo *git.Repository) error {
},
Auth: g.auth,
}); err != nil && err != git.NoErrAlreadyUpToDate {
log.Println(`Push 失败:`, err)
return err
return fmt.Errorf(`failed to git push: %w`, err)
}
return nil
}
Expand Down

0 comments on commit 70704e7

Please sign in to comment.