Allow configuring timeToLive for the connection pool
See original GitHub issueIs your feature request related to a problem? Please describe.
We are having some issues with regards to connection pools when releasing a new version of the service called by the unirest client. This release process involves updating the DNS entry for the load balancer and the clients need to refresh the connections in order to start calling the new version of the service. We’re looking into making it happen by leveraging the timeToLive functionality of the CPool used by the underlying apache client. However, currently it’s really hard to propagate this value to the pool instance and by default, this ttl is infinite.
Describe the solution you’d like
Exposing an additional configuration parameter (connectionTimeToLive) in the kong.unirest.Config that would be picked up when initializing the PoolingNHttpClientConnectionManager from the ApacheAsyncClient.
Describe alternatives you’ve considered
I’ve considered providing a custom instance of AsyncClient, but that involves a lot of duplication of the code already taken care of by ApacheAsyncClient.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5

Top Related StackOverflow Question
2.3.11 is now in maven central and has a new
connectionTTL(42, TimeUnit.MILLISECONDS)method on the config to set this.Awesome, thanks so much Ryan! Going to give it a try in prod next week!