From b8aaa5ff1a366676771e039e365102d7ca426c46 Mon Sep 17 00:00:00 2001 From: TimAle Date: Wed, 18 Nov 2020 13:16:16 +0300 Subject: [PATCH] HCX-124 Increase default HTTP timeouts --- Dockerfile | 6 +++++- Dockerfile.deploy | 4 +++- camunda.sh | 3 +++ src/org/camunda/latera/bss/http/HTTPRestProcessor.groovy | 8 +++++++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index a9f0d64e..0f4a4f43 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,11 @@ RUN rm -rf /camunda/webapps/camunda-invoice \ apk add wget curl busybox-extras -f USER camunda -RUN sed -i 's//<\/filter-mapping>/' /camunda/webapps/engine-rest/WEB-INF/web.xml + +RUN sed -i 's//<\/filter-mapping>/' /camunda/webapps/engine-rest/WEB-INF/web.xml && \ + sed -i 's/connectionTimeout="20000"/connectionTimeout="600000"/g' /camunda/conf/server.xml + COPY --chown=camunda:camunda ./camunda.sh /camunda/ COPY ./context.xml /camunda/conf/ diff --git a/Dockerfile.deploy b/Dockerfile.deploy index 90e85a57..34ad6c5e 100644 --- a/Dockerfile.deploy +++ b/Dockerfile.deploy @@ -58,7 +58,9 @@ RUN rm -rf /camunda/webapps/camunda-invoice \ USER camunda -RUN sed -i 's//<\/filter-mapping>/' /camunda/webapps/engine-rest/WEB-INF/web.xml +RUN sed -i 's//<\/filter-mapping>/' /camunda/webapps/engine-rest/WEB-INF/web.xml && \ + sed -i 's/connectionTimeout="20000"/connectionTimeout="600000"/g' /camunda/conf/server.xml COPY --chown=camunda:camunda ./camunda.sh /camunda/ COPY ./context.xml /camunda/conf/ diff --git a/camunda.sh b/camunda.sh index 2bfbd0ae..7376a80d 100755 --- a/camunda.sh +++ b/camunda.sh @@ -49,6 +49,9 @@ export HTTP_PROXY_HOST="${HTTP_PROXY_HOST:-${BPM_PROXY_HOST-}}" export HTTP_PROXY_PORT="${HTTP_PROXY_PORT:-${BPM_PROXY_PORT-}}" export HTTP_PROXY_PROTOCOL="${HTTP_PROXY_PROTOCOL:-${BPM_PROXY_PROTOCOL-}}" export HTTP_REDIRECT_PORT="${HTTP_REDIRECT_PORT:-${BPM_REDIRECT_PORT:-$HTTP_PORT}}" +export HTTP_CONNECT_TIMEOUT_SEC="${HTTP_CONNECT_TIMEOUT_SEC:-300}" +export HTTP_READ_TIMEOUT_SEC="${HTTP_READ_TIMEOUT_SEC:-300}" +export HTTP_WRITE_TIMEOUT_SEC="${HTTP_WRITE_TIMEOUT_SEC:-300}" if [[ "x$HTTP_PROXY_HOST" != "x" || "x$HTTP_PROXY_PORT" != "x" || "x$HTTP_PROXY_PROTOCOL" != "x" ]]; then export HTTP_PROXY="true" diff --git a/src/org/camunda/latera/bss/http/HTTPRestProcessor.groovy b/src/org/camunda/latera/bss/http/HTTPRestProcessor.groovy index 7bfc701d..29ac590e 100644 --- a/src/org/camunda/latera/bss/http/HTTPRestProcessor.groovy +++ b/src/org/camunda/latera/bss/http/HTTPRestProcessor.groovy @@ -1,5 +1,6 @@ package org.camunda.latera.bss.http +import java.util.concurrent.TimeUnit import groovyx.net.http.OkHttpBuilder import groovyx.net.http.FromServer import groovyx.net.http.HttpException @@ -57,7 +58,12 @@ class HTTPRestProcessor { response.success responseBlock(false, this.supressRequestBodyLog) response.failure responseBlock(true, this.supressResponseBodyLog) - client.clientCustomizer { it.followRedirects = true } + client.clientCustomizer { + it.followRedirects = true + it.connectTimeout(ENV['HTTP_CONNECT_TIMEOUT_SEC'].toInteger(), TimeUnit.SECONDS) + it.readTimeout(ENV['HTTP_READ_TIMEOUT_SEC'].toInteger(), TimeUnit.SECONDS) + it.writeTimeout(ENV['HTTP_WRITE_TIMEOUT_SEC'].toInteger(), TimeUnit.SECONDS) + } if (notEmpty(params.user) && notEmpty(params.password)) { request.auth.basic(params.user, params.password)