mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
client-go: chain the error returned by rate limiter
This commit is contained in:
parent
a41f9e976d
commit
6acbe7e645
@ -504,7 +504,9 @@ func (r *Request) tryThrottleWithInfo(ctx context.Context, retryInfo string) err
|
||||
now := time.Now()
|
||||
|
||||
err := r.rateLimiter.Wait(ctx)
|
||||
|
||||
if err != nil {
|
||||
err = fmt.Errorf("client rate limiter Wait returned an error: %w", err)
|
||||
}
|
||||
latency := time.Since(now)
|
||||
|
||||
var message string
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
"crypto/x509"
|
||||
"crypto/x509/pkix"
|
||||
"encoding/pem"
|
||||
"errors"
|
||||
"math"
|
||||
"math/big"
|
||||
"os"
|
||||
@ -135,7 +136,9 @@ func TestCertRotationContinuousRequests(t *testing.T) {
|
||||
for range time.Tick(time.Second) {
|
||||
_, err := client.CoreV1().ServiceAccounts("default").List(ctx, v1.ListOptions{})
|
||||
if err != nil {
|
||||
if err == ctx.Err() {
|
||||
// client may wrap the context.Canceled error, so we can't
|
||||
// do 'err == ctx.Err()', instead use 'errors.Is'.
|
||||
if errors.Is(err, context.Canceled) {
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user