Increase FE timout 51/127351/3
authorvasraz <vasyl.razinkov@est.tech>
Thu, 24 Feb 2022 09:17:07 +0000 (09:17 +0000)
committerVasyl Razinkov <vasyl.razinkov@est.tech>
Mon, 28 Feb 2022 18:03:31 +0000 (18:03 +0000)
Change-Id: Id25eb2931119404a90a48ee7a50b286c975a6f82
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-3886

catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/SSLProxyServlet.java

index e74893f..891bc4a 100644 (file)
@@ -33,8 +33,7 @@ import org.slf4j.LoggerFactory;
 public abstract class SSLProxyServlet extends ProxyServlet {
 
     private static final long serialVersionUID = 1L;
-    private static final int TIMEOUT = 600000;
-    private static Logger log = LoggerFactory.getLogger(SSLProxyServlet.class.getName());
+    private static final Logger log = LoggerFactory.getLogger(SSLProxyServlet.class);
 
     @Override
     protected HttpClient createHttpClient() throws ServletException {
@@ -42,17 +41,19 @@ public abstract class SSLProxyServlet extends ProxyServlet {
             .getConfiguration();
         boolean isSecureClient = !config.getBeProtocol().equals(BeProtocol.HTTP.getProtocolName());
         HttpClient client = (isSecureClient) ? getSecureHttpClient() : super.createHttpClient();
-        setTimeout(TIMEOUT);
-        client.setIdleTimeout(TIMEOUT);
-        client.setStopTimeout(TIMEOUT);
+        int requestTimeout = config.getRequestTimeout() * 1000;
+        if (requestTimeout == 0) {
+            requestTimeout = 1200_000;
+        }
+        setTimeout(requestTimeout);
+        client.setIdleTimeout(requestTimeout);
+        client.setStopTimeout(requestTimeout);
         return client;
     }
 
     private HttpClient getSecureHttpClient() throws ServletException {
-        // Instantiate and configure the SslContextFactory
-        SslContextFactory sslContextFactory = new SslContextFactory(true);
         // Instantiate HttpClient with the SslContextFactory
-        HttpClient httpClient = new HttpClient(sslContextFactory);
+        final var httpClient = new HttpClient(new SslContextFactory.Client(true));
         // Configure HttpClient, for example:
         httpClient.setFollowRedirects(false);
         // Start HttpClient