Struct: client.DefaultRetryer

import "../ibm-cos-sdk-go/aws/client"

Overview

DefaultRetryer implements basic retry logic using exponential backoff for most services. If you want to implement custom retry logic, you can implement the request.Retryer interface.

Implemented Interfaces

s3crypto.Cipher, s3manager.ReadSeekerWriteTo, request.Retryer, s3manager.WriterReadFrom

Structure Field Summary collapse

Method Summary collapse

Structure Field Details

MaxRetryDelay time.Duration

MaxRetryDelay is the maximum retry delay before which retry must be performed. If not set, the value is 0ns.

MaxThrottleDelay time.Duration

MaxThrottleDelay is the maximum retry delay when throttled. If not set, the value is 0ns.

MinRetryDelay time.Duration

MinRetryDelay is the minimum retry delay after which retry will be performed. If not set, the value is 0ns.

MinThrottleDelay time.Duration

MinThrottleRetryDelay is the minimum retry delay when throttled. If not set, the value is 0ns.

NumMaxRetries int

Num max Retries is the number of max retries that will be performed. By default, this is zero.

Method Details

func (d DefaultRetryer) MaxRetries() int

MaxRetries returns the number of maximum returns the service will use to make an individual API request.



55
56
57
// File 'aws/client/default_retryer.go', line 55

func (d DefaultRetryer) MaxRetries() int { return d.NumMaxRetries }

func (d DefaultRetryer) RetryRules(r *request.Request) time.Duration

RetryRules returns the delay duration before retrying this request again



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// File 'aws/client/default_retryer.go', line 76

func (d DefaultRetryer) RetryRules(r *request.Request) time.Duration { // if number of max retries is zero, no retries will be performed. if d.NumMaxRetries == 0 { return 0 } // Sets default value for retryer members d.setRetryerDefaults() // minDelay is the minimum retryer delay minDelay := d.MinRetryDelay var initialDelay time.Duration isThrottle := r.IsErrorThrottle() if isThrottle { if delay, ok := getRetryAfterDelay(r); ok { initialDelay = delay } minDelay = d.MinThrottleDelay } retryCount := r.RetryCount // maxDelay the maximum retryer delay maxDelay := d.MaxRetryDelay if isThrottle { maxDelay = d.MaxThrottleDelay } var delay time.Duration // Logic to cap the retry count based on the minDelay provided actualRetryCount := int(math.Log2(float64(minDelay))) + 1 if actualRetryCount < 63-retryCount { delay = time.Duration(1<int64(retryCount)) * getJitterDelay(minDelay) if delay > maxDelay { delay = getJitterDelay(maxDelay / 2) } } else { delay = getJitterDelay(maxDelay / 2) } return delay + initialDelay }

func (d DefaultRetryer) ShouldRetry(r *request.Request) bool

ShouldRetry returns true if the request should be retried.



129
130
131
132
133
134
135
136
137
138
139
140
141
142
// File 'aws/client/default_retryer.go', line 129

func (d DefaultRetryer) ShouldRetry(r *request.Request) bool { // ShouldRetry returns false if number of max retries is 0. if d.NumMaxRetries == 0 { return false } // If one of the other handlers already set the retry state // we don't want to override it based on the service's state if r.Retryable != nil { return *r.Retryable } return r.IsErrorRetryable() || r.IsErrorThrottle() }