Browse Source

Using ClientConfiguration.DEFAULT_SOCKET_TIMEOUT as default value for read timeout

Alexander Kazakov 8 years ago
parent
commit
0a03a62ab6

+ 1 - 1
docs/plugins/discovery-ec2.asciidoc

@@ -133,7 +133,7 @@ with the right signer to use.
 ===== Read timeout
 
 Read timeout determines the amount of time to wait for data to be transferred over an established,
-open connection before the connection is timed out.
+open connection before the connection is timed out. Defaults to AWS SDK default value (`50 s`).
 It can be configured with `cloud.aws.read_timeout` (or `cloud.aws.ec2.read_timeout`) setting:
 
 [source, yaml]

+ 1 - 1
docs/plugins/repository-s3.asciidoc

@@ -141,7 +141,7 @@ use `S3SignerType`, which is Signature Version 2.
 ===== Read timeout
 
 Read timeout determines the amount of time to wait for data to be transferred over an established,
-open connection before the connection is timed out.
+open connection before the connection is timed out. Defaults to AWS SDK default value (`50s`).
 It can be configured with `cloud.aws.read_timeout` (or `cloud.aws.s3.read_timeout`) setting:
 
 [source, yaml]

+ 3 - 2
plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2Service.java

@@ -19,6 +19,7 @@
 
 package org.elasticsearch.cloud.aws;
 
+import com.amazonaws.ClientConfiguration;
 import com.amazonaws.Protocol;
 import com.amazonaws.services.ec2.AmazonEC2;
 import org.elasticsearch.common.settings.Setting;
@@ -83,8 +84,8 @@ public interface AwsEc2Service {
     /**
      * cloud.aws.read_timeout: Socket read timeout. Shared with repository-s3 plugin
      */
-    Setting<TimeValue> READ_TIMEOUT = Setting.timeSetting("cloud.aws.read_timeout", TimeValue.MINUS_ONE,
-        Property.NodeScope, Property.Shared);
+    Setting<TimeValue> READ_TIMEOUT = Setting.timeSetting("cloud.aws.read_timeout",
+        TimeValue.timeValueMillis(ClientConfiguration.DEFAULT_SOCKET_TIMEOUT), Property.NodeScope, Property.Shared);
 
     /**
      * Defines specific ec2 settings starting with cloud.aws.ec2.

+ 1 - 4
plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImpl.java

@@ -125,10 +125,7 @@ public class AwsEc2ServiceImpl extends AbstractComponent implements AwsEc2Servic
             10,
             false);
         clientConfiguration.setRetryPolicy(retryPolicy);
-
-        if (READ_TIMEOUT.exists(settings) || CLOUD_EC2.READ_TIMEOUT.exists(settings)) {
-            clientConfiguration.setSocketTimeout((int) CLOUD_EC2.READ_TIMEOUT.get(settings).millis());
-        }
+        clientConfiguration.setSocketTimeout((int) CLOUD_EC2.READ_TIMEOUT.get(settings).millis());
 
         return clientConfiguration;
     }

+ 3 - 2
plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/AwsS3Service.java

@@ -19,6 +19,7 @@
 
 package org.elasticsearch.cloud.aws;
 
+import com.amazonaws.ClientConfiguration;
 import com.amazonaws.Protocol;
 import com.amazonaws.services.s3.AmazonS3;
 import org.elasticsearch.common.component.LifecycleComponent;
@@ -80,8 +81,8 @@ public interface AwsS3Service extends LifecycleComponent {
     /**
      * cloud.aws.read_timeout: Socket read timeout. Shared with discovery-ec2 plugin
      */
-    Setting<TimeValue> READ_TIMEOUT = Setting.timeSetting("cloud.aws.read_timeout", TimeValue.MINUS_ONE,
-        Property.NodeScope, Property.Shared);
+    Setting<TimeValue> READ_TIMEOUT = Setting.timeSetting("cloud.aws.read_timeout",
+        TimeValue.timeValueMillis(ClientConfiguration.DEFAULT_SOCKET_TIMEOUT), Property.NodeScope, Property.Shared);
 
     /**
      * Defines specific s3 settings starting with cloud.aws.s3.

+ 1 - 3
plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/InternalAwsS3Service.java

@@ -116,9 +116,7 @@ public class InternalAwsS3Service extends AbstractLifecycleComponent implements
             AwsSigner.configureSigner(awsSigner, clientConfiguration, endpoint);
         }
 
-        if (READ_TIMEOUT.exists(settings) || CLOUD_S3.READ_TIMEOUT.exists(settings)) {
-            clientConfiguration.setSocketTimeout((int) CLOUD_S3.READ_TIMEOUT.get(settings).millis());
-        }
+        clientConfiguration.setSocketTimeout((int) CLOUD_S3.READ_TIMEOUT.get(settings).millis());
 
         return clientConfiguration;
     }