Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HCX-124 Increase default HTTP timeouts #90

Merged
merged 1 commit into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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