spring-cloud-openfeign icon indicating copy to clipboard operation
spring-cloud-openfeign copied to clipboard

Disable loadbalancer clients retry when clients retry is disabled

Open WonSik36 opened this issue 3 years ago • 0 comments
trafficstars

Hi, I wrote this PR because the load balancer client retry properties did not work as expected.

I have loadbalancer properties as below (1 default, 1 individual clients)

spring.cloud.loadbalancer:
  retry:
    enabled: true
    retryable-status-codes: 503
    max-retries-on-next-service-instance: 1

  clients:
    retry-disabled-service:
      retry:
        enabled: false

And I expect when I execute retry-disabled-service client it should not retry. However, the client will do the retry as set in default properties.

I think the enabled property of that individual client retry should be checked. reference And I checked spring.cloud.loadbalancer.clients.<clientId>.retry.enabled is not checked when set RetryPolicy to RetryTemplate.

Therefore, I made this pull request with reference to RetryLoadBalancerInterceptor#createRetryTemplate. Plus, I added test, too.

WonSik36 avatar Sep 09 '22 11:09 WonSik36