我的yml:
spring:
application:
name: test-gateway
cloud:
loadbalancer:
retry:
enabled: true
zuul:
retryable: true
set-content-length: true
routes:
test:
path: /**
serviceId: TEST
stripPrefix: false
sensitiveHeaders: Cookie,Set-Cookie
ribbon:
eager-load:
enabled: true
include-debug-header: true
host:
connect-timeout-millis: 1000
socket-timeout-millis: 1000
TEST:
ribbon:
ReadTimeout: 1000
ConnectTimeout: 1000
retryableStatusCodes: 500, 503, 502, 408
MaxAutoRetriesNextServer: 0
OkToRetryOnAllOperations: true
MaxAutoRetries: 3
当我调用API /foruser时它休眠了3000毫秒
@GetMapping("/foruser")
public String forUser() throws InterruptedException {
log.info("Start to sleep count: {}", count);
count = count + 1;
sleep(3000);
log.info("Finish sleep");
return "every thing is ok";
}
应该只重试3次,但重复8次。为什么?我怎么能设置为只重试3次?哪里是任何更多的配置功能区?
1条答案
按热度按时间lb3vh1jj1#
Probem是我的Spring Boot 版本。需要zuul配置。在那里我添加github链接是人写的zuul配置修复了我的问题:https://gist.github.com/aldobongio/6a22f49863c7a777612f7887bbb8fd1d .希望这对某人有帮助。