Skip to content

Commit

Permalink
HCX-124 Increase default HTTP timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
TimAle authored and hydra-billing-robot committed Nov 20, 2020
1 parent 8680227 commit e4248d8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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>/<filter>/' /camunda/webapps/engine-rest/WEB-INF/web.xml && sed -i 's/<\/filter-mapping> -->/<\/filter-mapping>/' /camunda/webapps/engine-rest/WEB-INF/web.xml

RUN sed -i 's/<!-- <filter>/<filter>/' /camunda/webapps/engine-rest/WEB-INF/web.xml && \
sed -i 's/<\/filter-mapping> -->/<\/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/

Expand Down
4 changes: 3 additions & 1 deletion Dockerfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ RUN rm -rf /camunda/webapps/camunda-invoice \

USER camunda

RUN sed -i 's/<!-- <filter>/<filter>/' /camunda/webapps/engine-rest/WEB-INF/web.xml && sed -i 's/<\/filter-mapping> -->/<\/filter-mapping>/' /camunda/webapps/engine-rest/WEB-INF/web.xml
RUN sed -i 's/<!-- <filter>/<filter>/' /camunda/webapps/engine-rest/WEB-INF/web.xml && \
sed -i 's/<\/filter-mapping> -->/<\/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/
Expand Down
3 changes: 3 additions & 0 deletions camunda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 7 additions & 1 deletion src/org/camunda/latera/bss/http/HTTPRestProcessor.groovy
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e4248d8

Please sign in to comment.