Skip to content

Commit

Permalink
Fix the issue that download retry may timeout without retry (#1137)
Browse files Browse the repository at this point in the history
The reason is that the `Retry` operation include the elapsed time of
the first attempt into the total elapsed time, if the network is slow
and the first attempt consume too much time, the `Retry` operation
will timeout.

Fix #1015

Co-authored-by: Ti Chi Robot <71242396+ti-chi-bot@users.noreply.github.com>
  • Loading branch information
lucklove and ti-chi-bot authored Feb 19, 2021
1 parent 39532ee commit 8ecc546
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/repository/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,9 @@ func (l *httpMirror) Download(resource, targetDir string) error {
return nil
}
return r.Close()
}, utils.RetryOption{
Timeout: time.Hour,
Attempts: 3,
})
if err != nil {
return err
Expand Down

0 comments on commit 8ecc546

Please sign in to comment.