mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 01:06:27 +00:00
replace HTTP code with HTTP status code const
This commit is contained in:
parent
7a09ba96d8
commit
c2a16713b1
@ -129,7 +129,7 @@ func newWalkFunc(invalidLink *bool, client *http.Client) filepath.WalkFunc {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if resp.StatusCode == 429 {
|
if resp.StatusCode == http.StatusTooManyRequests {
|
||||||
retryAfter := resp.Header.Get("Retry-After")
|
retryAfter := resp.Header.Get("Retry-After")
|
||||||
if seconds, err := strconv.Atoi(retryAfter); err != nil {
|
if seconds, err := strconv.Atoi(retryAfter); err != nil {
|
||||||
backoff = seconds + 10
|
backoff = seconds + 10
|
||||||
@ -138,7 +138,7 @@ func newWalkFunc(invalidLink *bool, client *http.Client) filepath.WalkFunc {
|
|||||||
time.Sleep(time.Duration(backoff) * time.Second)
|
time.Sleep(time.Duration(backoff) * time.Second)
|
||||||
backoff *= 2
|
backoff *= 2
|
||||||
retry++
|
retry++
|
||||||
} else if resp.StatusCode == 404 {
|
} else if resp.StatusCode == http.StatusNotFound {
|
||||||
// We only check for 404 error for now. 401, 403 errors are hard to handle.
|
// We only check for 404 error for now. 401, 403 errors are hard to handle.
|
||||||
|
|
||||||
// We need to try a GET to avoid false alert.
|
// We need to try a GET to avoid false alert.
|
||||||
@ -146,7 +146,7 @@ func newWalkFunc(invalidLink *bool, client *http.Client) filepath.WalkFunc {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if resp.StatusCode != 404 {
|
if resp.StatusCode != http.StatusNotFound {
|
||||||
continue URL
|
continue URL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user