You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/09/22 02:50:00 UTC

[james-project] branch master updated: [FIX] S3: apply timeouts configuration (#1202)

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git


The following commit(s) were added to refs/heads/master by this push:
     new 033cb92284 [FIX] S3: apply timeouts configuration (#1202)
033cb92284 is described below

commit 033cb92284958e64b80ae1cd5738f3608791e5c6
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Thu Sep 22 09:49:55 2022 +0700

    [FIX] S3: apply timeouts configuration (#1202)
---
 .../james/blob/objectstorage/aws/S3BlobStoreDAO.java     | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/server/blob/blob-s3/src/main/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAO.java b/server/blob/blob-s3/src/main/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAO.java
index 8315b14ae2..970a09e557 100644
--- a/server/blob/blob-s3/src/main/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAO.java
+++ b/server/blob/blob-s3/src/main/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAO.java
@@ -109,10 +109,7 @@ public class S3BlobStoreDAO implements BlobStoreDAO, Startable, Closeable {
         client = S3AsyncClient.builder()
             .credentialsProvider(StaticCredentialsProvider.create(
                 AwsBasicCredentials.create(authConfiguration.getAccessKeyId(), authConfiguration.getSecretKey())))
-            .httpClientBuilder(NettyNioAsyncHttpClient.builder()
-                .tlsTrustManagersProvider(getTrustManagerProvider(configuration.getSpecificAuthConfiguration()))
-                .maxConcurrency(configuration.getHttpConcurrency())
-                .maxPendingConnectionAcquires(10_000))
+            .httpClientBuilder(httpClientBuilder(configuration))
             .endpointOverride(authConfiguration.getEndpoint())
             .region(configuration.getRegion().asAws())
             .serviceConfiguration(pathStyleAccess)
@@ -124,6 +121,17 @@ public class S3BlobStoreDAO implements BlobStoreDAO, Startable, Closeable {
             .build();
     }
 
+    private NettyNioAsyncHttpClient.Builder httpClientBuilder(S3BlobStoreConfiguration configuration) {
+        NettyNioAsyncHttpClient.Builder result = NettyNioAsyncHttpClient.builder()
+            .tlsTrustManagersProvider(getTrustManagerProvider(configuration.getSpecificAuthConfiguration()))
+            .maxConcurrency(configuration.getHttpConcurrency())
+            .maxPendingConnectionAcquires(10_000);
+        configuration.getWriteTimeout().ifPresent(result::writeTimeout);
+        configuration.getReadTimeout().ifPresent(result::readTimeout);
+        configuration.getConnectionTimeout().ifPresent(result::connectionTimeout);
+        return result;
+    }
+
     private TlsTrustManagersProvider getTrustManagerProvider(AwsS3AuthConfiguration configuration) {
         try {
             TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org