Skip to content

Commit 99cf40a

Browse files
committed
delete dax original retryer
1 parent 9a96dfb commit 99cf40a

File tree

2 files changed

+0
-138
lines changed

2 files changed

+0
-138
lines changed

dax/internal/client/dax_retryer.go

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -24,63 +24,6 @@ import (
2424
"github.com/aws/smithy-go"
2525
)
2626

27-
////DaxRetryer implements EqualJitterBackoffStratergy for throttled requests
28-
//type DaxRetryer struct {
29-
// BaseThrottleDelay time.Duration
30-
// MaxBackoffDelay time.Duration
31-
//}
32-
//
33-
//const (
34-
// //DefaultBaseRetryDelay is base delay for throttled requests
35-
// DefaultBaseRetryDelay = 70 * time.Millisecond
36-
// //DefaultMaxBackoffDelay is max backoff delay for throttled requests
37-
// DefaultMaxBackoffDelay = 20 * time.Second
38-
//)
39-
//
40-
//func (r *DaxRetryer) setRetryerDefaults() {
41-
// if r.BaseThrottleDelay == 0 {
42-
// r.BaseThrottleDelay = DefaultBaseRetryDelay
43-
// }
44-
// if r.MaxBackoffDelay == 0 {
45-
// r.MaxBackoffDelay = DefaultMaxBackoffDelay
46-
// }
47-
//}
48-
//
49-
////RetryRules returns the delay duration before retrying this request again
50-
//func (r DaxRetryer) RetryRules(req *request.Request) time.Duration {
51-
// // ??? ProvisionedThroughputExceededException
52-
// if req.IsErrorThrottle() {
53-
// r.setRetryerDefaults()
54-
// attempt := req.RetryCount
55-
// minDelay := time.Duration(1<<uint64(attempt)) * r.BaseThrottleDelay
56-
// if minDelay > r.MaxBackoffDelay {
57-
// minDelay = r.MaxBackoffDelay
58-
// }
59-
// jitter := time.Duration(rand.Intn(int(minDelay)/2 + 1))
60-
//
61-
// return minDelay/2 + jitter
62-
// }
63-
// return 0
64-
//}
65-
//
66-
////ShouldRetry returns true if the request should be retried.
67-
//func (r DaxRetryer) ShouldRetry(req *request.Request) bool {
68-
// daxErr := req.Error.(daxError)
69-
// codes := daxErr.CodeSequence()
70-
// return len(codes) > 0 && (codes[0] == 1 || codes[0] == 2) || req.IsErrorThrottle() || isAuthCRequiredException(codes)
71-
//}
72-
//
73-
//// Error code [4.23.31.33] is for AuthenticationRequiredException
74-
//func isAuthCRequiredException(codes []int) bool {
75-
// return len(codes) == 4 && codes[0] == 4 && codes[1] == 23 && codes[2] == 31 && codes[3] == 33
76-
//}
77-
//
78-
//// MaxRetries returns the number of maximum retries the service will use to make
79-
//// an individual API request.
80-
//func (r DaxRetryer) MaxRetries() int {
81-
// return 0
82-
//}
83-
8427
// IsErrorRetryable returns if the error is daxError
8528
// if code sequences correct any condition return a value other than unknown.
8629
func IsErrorRetryable(err error) aws.Ternary {

dax/internal/client/dax_retryer_test.go

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -77,84 +77,3 @@ func TestSleep(t *testing.T) {
7777
t.Fatalf("err must be nil, but %T", err)
7878
}
7979
}
80-
81-
//func TestRetryThrottleCodes(t *testing.T) {
82-
//
83-
// req := request.Request{}
84-
// retryer := DaxRetryer{}
85-
// attempt := 2
86-
// req.RetryCount = attempt
87-
// baseThrottleDelay := 70 * time.Millisecond
88-
// //for throttling exception
89-
// req.Error = newDaxRequestFailure([]int{0}, "ThrottlingException", "", "", 400)
90-
//
91-
// if !retryer.ShouldRetry(&req) {
92-
// t.Errorf("expected retry on throttling")
93-
// }
94-
// delay := retryer.RetryRules(&req)
95-
// maxDelay := time.Duration(1<<uint64(attempt)) * baseThrottleDelay
96-
// if delay > maxDelay {
97-
// t.Errorf("delay more than expected, expected upto %d, got %d ", maxDelay, delay)
98-
// }
99-
// if delay <= 0 {
100-
// t.Errorf("delay for throttled error should be greater than 0, got %d", delay)
101-
// }
102-
//
103-
// //for non throttling exception
104-
// req.Error = newDaxRequestFailure([]int{0}, "AccessDeniedException", "", "", 400)
105-
// if retryer.ShouldRetry(&req) || retryer.RetryRules(&req) != 0 {
106-
// t.Errorf("no retry expected")
107-
// }
108-
//}
109-
//
110-
//func TestRetryOnThrottlingException(t *testing.T) {
111-
// cluster, _ := newTestCluster([]string{"127.0.0.1:8111"})
112-
// cluster.update([]serviceEndpoint{{hostname: "localhost", port: 8121}})
113-
// cc := ClusterDaxClient{config: DefaultConfig(), cluster: cluster}
114-
//
115-
// flag := 0
116-
// action := func(client DaxAPI, o RequestOptions) error {
117-
// if flag == 0 {
118-
// flag = 1
119-
// return newDaxRequestFailure([]int{0}, "ThrottlingException", "", "", 400)
120-
// }
121-
// return nil
122-
// }
123-
//
124-
// opt := RequestOptions{
125-
// MaxRetries: 2,
126-
// }
127-
//
128-
// err := cc.retry("op", action, opt)
129-
//
130-
// if err != nil {
131-
// t.Errorf("error %v", err)
132-
// }
133-
//}
134-
//
135-
//func TestRetryOnAuthenticationRequiredException(t *testing.T) {
136-
// cluster, _ := newTestCluster([]string{"127.0.0.1:8111"})
137-
// cluster.update([]serviceEndpoint{{hostname: "localhost", port: 8121}})
138-
// cc := ClusterDaxClient{config: DefaultConfig(), cluster: cluster}
139-
//
140-
// flag := 0
141-
// codes := []int{4, 23, 31, 33}
142-
// action := func(client DaxAPI, o RequestOptions) error {
143-
// if flag == 0 {
144-
// flag = 1
145-
// return newDaxRequestFailure(codes, "AuthenticationRequiredException", "", "", 400)
146-
// }
147-
// return nil
148-
// }
149-
//
150-
// opt := RequestOptions{
151-
// MaxRetries: 2,
152-
// }
153-
//
154-
// err := cc.retry("op", action, opt)
155-
//
156-
// if err != nil {
157-
// t.Errorf("error %v", err)
158-
// }
159-
//
160-
//}

0 commit comments

Comments
 (0)