|
31 | 31 | import org.apache.logging.log4j.LogManager;
|
32 | 32 | import org.apache.logging.log4j.Logger;
|
33 | 33 | import org.elasticsearch.ElasticsearchException;
|
34 |
| -import org.elasticsearch.common.Randomness; |
35 | 34 | import org.elasticsearch.common.Strings;
|
36 | 35 | import org.elasticsearch.common.util.LazyInitializable;
|
37 | 36 |
|
38 |
| -import java.util.Random; |
39 | 37 | import java.util.concurrent.atomic.AtomicReference;
|
40 | 38 |
|
41 | 39 | class AwsEc2ServiceImpl implements AwsEc2Service {
|
@@ -77,16 +75,7 @@ static ClientConfiguration buildConfiguration(Logger logger, Ec2ClientSettings c
|
77 | 75 | clientConfiguration.setProxyPassword(clientSettings.proxyPassword);
|
78 | 76 | }
|
79 | 77 | // Increase the number of retries in case of 5xx API responses
|
80 |
| - final Random rand = Randomness.get(); |
81 |
| - final RetryPolicy retryPolicy = new RetryPolicy( |
82 |
| - null, |
83 |
| - (originalRequest, exception, retriesAttempted) -> { |
84 |
| - // with 10 retries the max delay time is 320s/320000ms (10 * 2^5 * 1 * 1000) |
85 |
| - logger.warn("EC2 API request failed, retry again. Reason was:", exception); |
86 |
| - return 1000L * (long) (10d * Math.pow(2, retriesAttempted / 2.0d) * (1.0d + rand.nextDouble())); |
87 |
| - }, |
88 |
| - 10, |
89 |
| - false); |
| 78 | + final RetryPolicy retryPolicy = new RetryPolicy(null, null, 10, false); |
90 | 79 | clientConfiguration.setRetryPolicy(retryPolicy);
|
91 | 80 | clientConfiguration.setSocketTimeout(clientSettings.readTimeoutMillis);
|
92 | 81 | return clientConfiguration;
|
|
0 commit comments