From e747a2a7115a6522c15c2b473fdb176cfbe14f0e Mon Sep 17 00:00:00 2001 From: lepdou Date: Wed, 30 Mar 2022 20:24:41 +0800 Subject: [PATCH] 1. upgrade polaris-java version to 1.3.0 2. fix ratelimit desc when deny request 3. fix circuit break example bug --- CHANGELOG.md | 4 ++++ .../cloud/polaris/ratelimit/constant/RateLimitConstant.java | 3 ++- .../polaris/ratelimit/filter/QuotaCheckServletFilter.java | 4 ++-- spring-cloud-tencent-dependencies/pom.xml | 2 +- .../cloud/polaris/circuitbreaker/example/ServiceA.java | 3 +++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d74a8718a..093d63f8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,4 +11,8 @@ - [feat:optimize project structure and checkstyle](https://github.com/Tencent/spring-cloud-tencent/pull/56) - [feat:divide storage and transfer of metadata.](https://github.com/Tencent/spring-cloud-tencent/pull/63) - [feat:support polaris config center.](https://github.com/Tencent/spring-cloud-tencent/pull/69) +- [feat:optimize metadata module.](https://github.com/Tencent/spring-cloud-tencent/pull/70) +- [feat: optimize pom dependency and demo](https://github.com/Tencent/spring-cloud-tencent/pull/71) +- [feat:upgrade polaris version to 1.3.0.](https://github.com/Tencent/spring-cloud-tencent/pull/72) + diff --git a/spring-cloud-starter-tencent-polaris-ratelimit/src/main/java/com/tencent/cloud/polaris/ratelimit/constant/RateLimitConstant.java b/spring-cloud-starter-tencent-polaris-ratelimit/src/main/java/com/tencent/cloud/polaris/ratelimit/constant/RateLimitConstant.java index c5fde4af9..5c96b8646 100644 --- a/spring-cloud-starter-tencent-polaris-ratelimit/src/main/java/com/tencent/cloud/polaris/ratelimit/constant/RateLimitConstant.java +++ b/spring-cloud-starter-tencent-polaris-ratelimit/src/main/java/com/tencent/cloud/polaris/ratelimit/constant/RateLimitConstant.java @@ -13,6 +13,7 @@ * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. + * */ package com.tencent.cloud.polaris.ratelimit.constant; @@ -34,7 +35,7 @@ public final class RateLimitConstant { /** * Info of rate limit. */ - public static String QUOTA_LIMITED_INFO = "request blocked by polaris, reason is "; + public static String QUOTA_LIMITED_INFO = "The request is deny by rate limit because the throttling threshold is reached"; private RateLimitConstant() { } diff --git a/spring-cloud-starter-tencent-polaris-ratelimit/src/main/java/com/tencent/cloud/polaris/ratelimit/filter/QuotaCheckServletFilter.java b/spring-cloud-starter-tencent-polaris-ratelimit/src/main/java/com/tencent/cloud/polaris/ratelimit/filter/QuotaCheckServletFilter.java index dd19def58..c436272ae 100644 --- a/spring-cloud-starter-tencent-polaris-ratelimit/src/main/java/com/tencent/cloud/polaris/ratelimit/filter/QuotaCheckServletFilter.java +++ b/spring-cloud-starter-tencent-polaris-ratelimit/src/main/java/com/tencent/cloud/polaris/ratelimit/filter/QuotaCheckServletFilter.java @@ -13,6 +13,7 @@ * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. + * */ package com.tencent.cloud.polaris.ratelimit.filter; @@ -76,8 +77,7 @@ public class QuotaCheckServletFilter extends OncePerRequestFilter { localNamespace, localService, 1, labels, null); if (quotaResponse.getCode() == QuotaResultCode.QuotaResultLimited) { response.setStatus(TOO_MANY_REQUESTS.value()); - response.getWriter().write( - RateLimitConstant.QUOTA_LIMITED_INFO + quotaResponse.getInfo()); + response.getWriter().write(RateLimitConstant.QUOTA_LIMITED_INFO); } else { filterChain.doFilter(request, response); diff --git a/spring-cloud-tencent-dependencies/pom.xml b/spring-cloud-tencent-dependencies/pom.xml index 3e87e058d..eb776422d 100644 --- a/spring-cloud-tencent-dependencies/pom.xml +++ b/spring-cloud-tencent-dependencies/pom.xml @@ -63,7 +63,7 @@ 1.2.0-Hoxton.SR9-SNAPSHOT - 1.3.0-SNAPSHOT + 1.3.0 2.0.0 diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceA.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceA.java index bf77eccce..1c96db6c9 100644 --- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceA.java +++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceA.java @@ -13,12 +13,14 @@ * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. + * */ package com.tencent.cloud.polaris.circuitbreaker.example; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.Bean; import org.springframework.web.client.RestTemplate; @@ -37,6 +39,7 @@ public class ServiceA { } @Bean + @LoadBalanced public RestTemplate restTemplate() { return new RestTemplate(); }