koji: increment retry counter only when retrying
This commit is contained in:
parent
6b08b8ed63
commit
68639b4bf9
1 changed files with 6 additions and 2 deletions
|
|
@ -314,7 +314,6 @@ func (k *Koji) uploadChunk(chunk []byte, filepath, filename string, offset uint6
|
|||
retries := uint(0)
|
||||
|
||||
countingCheckRetry := func(ctx context.Context, resp *http.Response, err error) (bool, error) {
|
||||
retries++
|
||||
shouldRetry, retErr := rh.DefaultRetryPolicy(ctx, resp, err)
|
||||
|
||||
// DefaultRetryPolicy denies retrying for any certificate related error.
|
||||
|
|
@ -323,11 +322,16 @@ func (k *Koji) uploadChunk(chunk []byte, filepath, filename string, offset uint6
|
|||
if v, ok := err.(*url.Error); ok {
|
||||
if _, ok := v.Err.(x509.UnknownAuthorityError); ok {
|
||||
// retry if it's a timeout
|
||||
return strings.Contains(strings.ToLower(v.Error()), "timeout"), v
|
||||
shouldRetry = strings.Contains(strings.ToLower(v.Error()), "timeout")
|
||||
retErr = v
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if shouldRetry {
|
||||
retries++
|
||||
}
|
||||
|
||||
return shouldRetry, retErr
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue