In 2.2.2 RELEASE When I configured the Feign readTimeout and connectTimeout, I found that the Ribbon retry didn't work,like this:
ribbon:
MaxAutoRetries: 2
MaxAutoRetriesNextServer: 2
OkToRetryOnAllOperations: true
feign:
client:
config:
default:
connectTimeout: 2000
readTimeout: 2000
And then I found in FeignRibbonClientAutoConfiguration through debugging such configuration:
@Bean
@ConditionalOnMissingBean
public Request.Options feignRequestOptions() {
return LoadBalancerFeignClient.DEFAULT_OPTIONS;
}
And then the FeignClientFactoryBean#configureUsingConfiguration (), loading the Options:
Request.Options options = getOptional(context, Request.Options.class);
if (options != null) {
builder.options(options);
}
And next in FeignClientFactoryBean#configureUsingProperties(), because I added the timeout configuration, the default Options is now overridden:
if (config.getConnectTimeout() != null && config.getReadTimeout() != null) {
builder.options(new Request.Options(config.getConnectTimeout(),
config.getReadTimeout()));
}
Finally, this directly causes me to fail to get the MaxAutoRetries and MaxAutoRetriesNextServer in the Ribbon in the following code:
LoadBalancerFeignClient#getClientConfig()
IClientConfig getClientConfig(Request.Options options, String clientName) {
IClientConfig requestConfig;
if (options == DEFAULT_OPTIONS) {
requestConfig = this.clientFactory.getClientConfig(clientName);
}
else {
requestConfig = new FeignOptionsClientConfig(options);
}
return requestConfig;
}
Obviously, the object here is definitely not DEFAULT_OPTIONS
Was it designed that way?
Comment From: OlgaMaciaszek
@q398544597 will verify it.
Comment From: OlgaMaciaszek
The way it was being handled has been rearchitected and improved since and migrated to work with Spring Cloud LoadBalancer instead of Ribbon. It should have fixed the issue. If you're still experiencing a related issue on the currently supported versions of SC OpenFeign (3.1.6 or 4.0.1, please get back to us).
Comment From: spring-cloud-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-cloud-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.