@@ -206,24 +206,29 @@ func resolveRetryer(ctx context.Context, awsConfig *aws.Config) {
206206 })
207207 }
208208
209- var retryer aws.RetryerV2
210- switch retryMode {
211- case aws .RetryModeAdaptive :
212- var adaptiveOptions []func (* retry.AdaptiveModeOptions )
213- if len (standardOptions ) != 0 {
214- adaptiveOptions = append (adaptiveOptions , func (ao * retry.AdaptiveModeOptions ) {
215- ao .StandardOptions = append (ao .StandardOptions , standardOptions ... )
216- })
209+ newRetryer := func (retryMode aws.RetryMode , standardOptions []func (* retry.StandardOptions )) aws.RetryerV2 {
210+ var retryer aws.RetryerV2
211+ switch retryMode {
212+ case aws .RetryModeAdaptive :
213+ var adaptiveOptions []func (* retry.AdaptiveModeOptions )
214+ if len (standardOptions ) != 0 {
215+ adaptiveOptions = append (adaptiveOptions , func (ao * retry.AdaptiveModeOptions ) {
216+ ao .StandardOptions = append (ao .StandardOptions , standardOptions ... )
217+ })
218+ }
219+ retryer = retry .NewAdaptiveMode (adaptiveOptions ... )
220+
221+ default :
222+ retryer = retry .NewStandard (standardOptions ... )
217223 }
218- retryer = retry .NewAdaptiveMode (adaptiveOptions ... )
219224
220- default :
221- retryer = retry .NewStandard (standardOptions ... )
225+ return retryer
222226 }
223227
224228 awsConfig .Retryer = func () aws.Retryer {
225229 return & networkErrorShortcutter {
226- RetryerV2 : retryer ,
230+ // Ensure that each invocation of this function returns an independent Retryer.
231+ RetryerV2 : newRetryer (retryMode , standardOptions ),
227232 }
228233 }
229234}
0 commit comments