release:release 1.6.0-Hoxton.SR12. (#398)

pull/326/merge 1.6.0-Hoxton.SR12
Haotian Zhang 2 years ago committed by GitHub
parent 8a451a2892
commit 35567d57aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -37,5 +37,6 @@
- [UT: add Polaris LoadBalancer unit test](https://github.com/Tencent/spring-cloud-tencent/pull/373)
- [docs:update docs](https://github.com/Tencent/spring-cloud-tencent/pull/378)
- [docs:optimize example](https://github.com/Tencent/spring-cloud-tencent/pull/385)
- [Optimize starters auto-configuration. (main)](https://github.com/Tencent/spring-cloud-tencent/pull/391/files)
- [Feature: format code](https://github.com/Tencent/spring-cloud-tencent/pull/394)
- [test: add PostInitPolarisSDKContextTest](https://github.com/Tencent/spring-cloud-tencent/pull/397)

@ -86,7 +86,7 @@
<properties>
<!-- Project revision -->
<revision>1.6.0-Hoxton.SR12-SNAPSHOT</revision>
<revision>1.6.0-Hoxton.SR12</revision>
<!-- Spring Cloud -->
<spring.cloud.version>Hoxton.SR12</spring.cloud.version>

@ -70,8 +70,8 @@
</developers>
<properties>
<revision>1.6.0-Hoxton.SR12-SNAPSHOT</revision>
<polaris.version>1.7.0-SNAPSHOT</polaris.version>
<revision>1.6.0-Hoxton.SR12</revision>
<polaris.version>1.7.0</polaris.version>
<logback.version>1.2.11</logback.version>
<mocktio.version>4.5.1</mocktio.version>
<byte-buddy.version>1.12.10</byte-buddy.version>

@ -17,6 +17,7 @@
package com.tencent.cloud.ratelimit.example.service.callee;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
@ -45,17 +46,15 @@ public class BusinessController {
private static final Logger LOG = LoggerFactory.getLogger(BusinessController.class);
private final AtomicInteger index = new AtomicInteger(0);
private final AtomicLong lastTimestamp = new AtomicLong(0);
@Autowired
private RestTemplate restTemplate;
@Value("${spring.application.name}")
private String appName;
private AtomicLong lastTimestamp = new AtomicLong(0);
/**
* Get information.
*
* @return information
*/
@GetMapping("/info")
@ -63,30 +62,41 @@ public class BusinessController {
return "hello world for ratelimit service " + index.incrementAndGet();
}
/**
* Get information 30 times per 1 second.
*
* @return result of 30 calls.
* @throws InterruptedException exception
*/
@GetMapping("/invoke")
public String invokeInfo() {
StringBuilder builder = new StringBuilder();
public String invokeInfo() throws InterruptedException {
StringBuffer builder = new StringBuffer();
CountDownLatch count = new CountDownLatch(30);
for (int i = 0; i < 30; i++) {
try {
ResponseEntity<String> entity = restTemplate.getForEntity(
"http://" + appName + "/business/info", String.class);
builder.append(entity.getBody()).append("<br/>");
}
catch (RestClientException e) {
if (e instanceof TooManyRequests) {
builder.append(((TooManyRequests) e).getResponseBodyAsString())
.append(index.incrementAndGet()).append("<br/>");
new Thread(() -> {
try {
ResponseEntity<String> entity = restTemplate.getForEntity("http://" + appName + "/business/info",
String.class);
builder.append(entity.getBody() + "\n");
}
else {
throw e;
catch (RestClientException e) {
if (e instanceof TooManyRequests) {
builder.append("TooManyRequests " + index.incrementAndGet() + "\n");
}
else {
throw e;
}
}
}
count.countDown();
}).start();
}
count.await();
return builder.toString();
}
/**
* Get information with unirate.
*
* @return information
*/
@GetMapping("/unirate")

Loading…
Cancel
Save