mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Merge pull request #55307 from xiangpengzhao/fix-aws-panic
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Check if SleepDelay of AWS request is nil before sign. **What this PR does / why we need it**: **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #55309 **Special notes for your reviewer**: /cc @justinsb **Release note**: ```release-note NONE ```
This commit is contained in:
commit
d1e711a6af
@ -21,6 +21,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||||
"github.com/aws/aws-sdk-go/aws/request"
|
"github.com/aws/aws-sdk-go/aws/request"
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
@ -53,7 +54,15 @@ func (c *CrossRequestRetryDelay) BeforeSign(r *request.Request) {
|
|||||||
if delay > 0 {
|
if delay > 0 {
|
||||||
glog.Warningf("Inserting delay before AWS request (%s) to avoid RequestLimitExceeded: %s",
|
glog.Warningf("Inserting delay before AWS request (%s) to avoid RequestLimitExceeded: %s",
|
||||||
describeRequest(r), delay.String())
|
describeRequest(r), delay.String())
|
||||||
r.Config.SleepDelay(delay)
|
|
||||||
|
if sleepFn := r.Config.SleepDelay; sleepFn != nil {
|
||||||
|
// Support SleepDelay for backwards compatibility
|
||||||
|
sleepFn(delay)
|
||||||
|
} else if err := aws.SleepWithContext(r.Context(), delay); err != nil {
|
||||||
|
r.Error = awserr.New(request.CanceledErrorCode, "request context canceled", err)
|
||||||
|
r.Retryable = aws.Bool(false)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Avoid clock skew problems
|
// Avoid clock skew problems
|
||||||
r.Time = now
|
r.Time = now
|
||||||
|
Loading…
Reference in New Issue
Block a user