mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 23:37:01 +00:00
Throttle retried requests in client
This commit is contained in:
parent
57a47b6af5
commit
564fc0cc80
@ -795,6 +795,12 @@ func (r *Request) request(fn func(*http.Request, *http.Response)) error {
|
|||||||
req.Header = r.headers
|
req.Header = r.headers
|
||||||
|
|
||||||
r.backoffMgr.Sleep(r.backoffMgr.CalculateBackoff(r.URL()))
|
r.backoffMgr.Sleep(r.backoffMgr.CalculateBackoff(r.URL()))
|
||||||
|
if retries > 0 {
|
||||||
|
// We are retrying the request that we already send to apiserver
|
||||||
|
// at least once before.
|
||||||
|
// This request should also be throttled with the client-internal throttler.
|
||||||
|
r.tryThrottle()
|
||||||
|
}
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
updateURLMetrics(r, resp, err)
|
updateURLMetrics(r, resp, err)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user