spring-cloud-openfeign
spring-cloud-openfeign copied to clipboard
connecttimeout and readtimeout will be reset when client has any configuration
trafficstars
Describe the bug After the bug (Read timeout from application properties is not used when client is configured ) was fixed in v2.2.4.RELEASE, connect timeout and readtimeout of LoadBalancerFeignClient cannot work when client has any configuration.
Sample When feign client not config, the readtimeout and connecttimeout load by IClientConfig is 1000ms / 1000ms (default, or configed to others ) ( see LoadBalancerFeignClient#L97)
//LoadBalancerFeignClient#L97
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;
}
and
//FeignClientFactoryBean with bug 323:
if (config.getConnectTimeout() != null && config.getReadTimeout() != null) {
builder.options(new Request.Options(config.getConnectTimeout(),
config.getReadTimeout()));
}
It was worked before bug 323 fixed in FeignClientFactoryBean.java. But now when client has any configuration, readtimeout and connecttimeout (1000ms/1000ms) will be reset to 10000ms and 60000ms. For example, put a Logger leave in properties:
feign.client.config.default.loggerLevel=FULL