@@ -78,6 +78,10 @@ func (c *DBApiClientConfig) Setup() {
78
78
if c .TimeoutSeconds == 0 {
79
79
c .TimeoutSeconds = 60
80
80
}
81
+ // Set up a retryable HTTP Client to handle cases where the service returns
82
+ // a transient error on initial creation
83
+ retryDelayDuration := 10 * time .Second
84
+ retryMaximumDuration := 5 * time .Minute
81
85
c .client = retryablehttp.Client {
82
86
HTTPClient : & http.Client {
83
87
Timeout : time .Duration (time .Duration (c .TimeoutSeconds ) * time .Second ),
@@ -88,7 +92,15 @@ func (c *DBApiClientConfig) Setup() {
88
92
},
89
93
},
90
94
CheckRetry : checkHTTPRetry ,
91
- // TODO - default is exponential backoff - do we want that, or linear backoff?????????????????????
95
+ // Using a linear retry rather than the default exponential retry
96
+ // as the creation condition is normally passed after 30-40 seconds
97
+ // Setting the retry interval to 10 seconds. Setting RetryWaitMin and RetryWaitMax
98
+ // to the same value removes jitter (which would be useful in a high-volume traffic scenario
99
+ // but wouldn't add much here)
100
+ Backoff : retryablehttp .LinearJitterBackoff ,
101
+ RetryWaitMin : retryDelayDuration ,
102
+ RetryWaitMax : retryDelayDuration ,
103
+ RetryMax : int (retryMaximumDuration / retryDelayDuration ),
92
104
}
93
105
}
94
106
0 commit comments