diff --git a/docker_build/gate.yml b/docker_build/gate.yml index aba748756d..0d4e9af8ac 100644 --- a/docker_build/gate.yml +++ b/docker_build/gate.yml @@ -23,6 +23,14 @@ services: enabled: true oesui: externalUrl: http://150.238.22.102 + +retrofit: + connectTimeout: 30000 + readTimeout: 30000 + callTimeout: 30000 + writeTimeout: 30000 + retryOnConnectionFailure: true + security: basic: enabled: false diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/config/RetrofitConfig.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/config/RetrofitConfig.groovy index 5814ed8afe..5b49d147bd 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/config/RetrofitConfig.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/config/RetrofitConfig.groovy @@ -17,18 +17,37 @@ package com.netflix.spinnaker.gate.config import com.netflix.spinnaker.config.OkHttp3ClientConfiguration +import groovy.transform.Canonical import okhttp3.OkHttpClient import org.springframework.beans.factory.config.ConfigurableBeanFactory +import org.springframework.boot.context.properties.ConfigurationProperties import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Scope +import java.util.concurrent.TimeUnit + +@Canonical @Configuration +@ConfigurationProperties(prefix = "retrofit") class RetrofitConfig { + + Long connectTimeout + Long readTimeout + Long callTimeout + Long writeTimeout + Boolean retryOnConnectionFailure + @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) OkHttpClient okHttpClient(OkHttp3ClientConfiguration okHttpClientConfig) { - return okHttpClientConfig.create().build() + return okHttpClientConfig.create() + .connectTimeout(connectTimeout, TimeUnit.MILLISECONDS) + .readTimeout(readTimeout, TimeUnit.MILLISECONDS) + .callTimeout(callTimeout, TimeUnit.MILLISECONDS) + .writeTimeout(writeTimeout, TimeUnit.MILLISECONDS) + .retryOnConnectionFailure(retryOnConnectionFailure) + .build() } }