Skip to content

Commit

Permalink
Merge pull request #96 from cfieber/master
Browse files Browse the repository at this point in the history
add connectionPool configuration that seems to soothe the OkHttpClient
  • Loading branch information
cfieber authored Jul 1, 2016
2 parents d665d73 + 192219b commit 4bbf2cf
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package com.netflix.spinnaker.echo.config

import com.netflix.spinnaker.config.OkHttpClientConfiguration
import com.squareup.okhttp.ConnectionPool
import com.squareup.okhttp.OkHttpClient
import org.springframework.beans.factory.annotation.Autowired

Expand All @@ -42,9 +43,21 @@ class Front50Config {
@Autowired
OkHttpClientConfiguration okHttpClientConfig

@Value('${okHttpClient.connectionPool.maxIdleConnections:5}')
int maxIdleConnections

@Value('${okHttpClient.connectionPool.keepAliveDurationMs:300000}')
int keepAliveDurationMs

@Value('${okHttpClient.retryOnConnectionFailure:true}')
boolean retryOnConnectionFailure

@Bean
OkHttpClient okHttpClient() {
return okHttpClientConfig.create()
def cli = okHttpClientConfig.create()
cli.connectionPool = new ConnectionPool(maxIdleConnections, keepAliveDurationMs)
cli.retryOnConnectionFailure = retryOnConnectionFailure
return cli
}

@Bean
Expand Down

0 comments on commit 4bbf2cf

Please sign in to comment.