docs:update circuit breaker examples. (#1521)

pull/1522/head
Haotian Zhang 5 months ago committed by GitHub
parent 3b5dd83e24
commit d1cf8ef478
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -21,4 +21,5 @@
- [feat:upgrade trace plugin.](https://github.com/Tencent/spring-cloud-tencent/pull/1467)
- [feat:upgrade 2.0.0 service.](https://github.com/Tencent/spring-cloud-tencent/pull/1471)
- [fix:fix zuul delay circuit breaker.](https://github.com/Tencent/spring-cloud-tencent/pull/1519)
- [fix:fix watch tsf config, fix bean refresh with RefreshScope and ConfigurationProperties.](https://github.com/Tencent/spring-cloud-tencent/pull/1520)
- [fix:fix watch tsf config, fix bean refresh with RefreshScope and ConfigurationProperties.](https://github.com/Tencent/spring-cloud-tencent/pull/1520)
- [docs:update circuit breaker examples.](https://github.com/Tencent/spring-cloud-tencent/pull/1521)

@ -61,7 +61,7 @@ public class QuickstartCalleeController {
@Autowired
private DataSourceProperties dataSourceProperties;
private boolean ifBadGateway = true;
private boolean ifDelay = false;
private int delay = 0;
/**
* Get sum of two value.
@ -111,8 +111,8 @@ public class QuickstartCalleeController {
LOG.info("Quickstart Callee Service [{}:{}] is called wrong.", ip, port);
return new ResponseEntity<>("failed for call quickstart callee service.", HttpStatus.BAD_GATEWAY);
}
if (ifDelay) {
Thread.sleep(200);
if (delay > 0) {
Thread.sleep(delay);
LOG.info("Quickstart Callee Service [{}:{}] is called slow.", ip, port);
return new ResponseEntity<>(String.format("Quickstart Callee Service [%s:%s] is called slow.", ip, port), HttpStatus.OK);
}
@ -131,8 +131,8 @@ public class QuickstartCalleeController {
LOG.info("Quickstart Callee Service with uid {} [{}:{}] is called wrong.", uid, ip, port);
return new ResponseEntity<>("failed for call quickstart callee service wildcard.", HttpStatus.BAD_GATEWAY);
}
if (ifDelay) {
Thread.sleep(200);
if (delay > 0) {
Thread.sleep(delay);
LOG.info("Quickstart Callee Service uid {} [{}:{}] is called slow.", uid, ip, port);
return new ResponseEntity<>(String.format("Quickstart Callee Service [%s:%s] is called slow.", ip, port), HttpStatus.OK);
}
@ -154,13 +154,14 @@ public class QuickstartCalleeController {
}
@GetMapping("/setDelay")
public String setDelay(@RequestParam boolean param) {
this.ifDelay = param;
if (param) {
LOG.info("info is set to delay 200ms.");
return "info is set to delay 200ms.";
public String setDelay(@RequestParam int param) {
this.delay = param;
if (delay > 0) {
LOG.info("info is set to delay {}ms.", delay);
return "info is set to delay " + delay + "ms.";
}
else {
delay = 0;
LOG.info("info is set to no delay.");
return "info is set to no delay.";
}
@ -172,8 +173,8 @@ public class QuickstartCalleeController {
LOG.info("Quickstart Callee Service [{}:{}] is detected wrong.", ip, port);
return new ResponseEntity<>(String.format("Quickstart Callee Service [%s:%s] is detected wrong.", ip, port), HttpStatus.BAD_GATEWAY);
}
if (ifDelay) {
Thread.sleep(200);
if (delay > 0) {
Thread.sleep(delay);
LOG.info("Quickstart Callee Service [{}:{}] is detected slow.", ip, port);
return new ResponseEntity<>(String.format("Quickstart Callee Service [%s:%s] is detected slow.", ip, port), HttpStatus.OK);
}

@ -26,3 +26,7 @@ zuul:
QuickstartCalleeService:
serviceId: QuickstartCalleeService
path: /QuickstartCalleeService/**
ribbon:
ConnectTimeout: 10000
ReadTimeout: 10000
Loading…
Cancel
Save