From 12742afdb4d25fba5a4e85879284897bf0061fda Mon Sep 17 00:00:00 2001 From: Pranav Bhaskaran <67958542+Pranav-b-7@users.noreply.github.com> Date: Tue, 19 Oct 2021 13:38:19 +0530 Subject: [PATCH] Op 7784 v3.9 (#72) --- docker_build/gate.yml | 8 +++++++ .../gate/config/RetrofitConfig.groovy | 21 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/docker_build/gate.yml b/docker_build/gate.yml index ff7062e2db..e92a873ccc 100644 --- a/docker_build/gate.yml +++ b/docker_build/gate.yml @@ -17,6 +17,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() } }