Skip to content

Commit 8372b35

Browse files
fredrikliuSkyeBeFreeman
authored andcommitted
fix: fix the ratelimit bug for 2023 (#1316)
1 parent c35d4e2 commit 8372b35

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
- [feat: add lane router examples](https://github.com/Tencent/spring-cloud-tencent/pull/1260)
88
- [feat:upgrade jackson version.](https://github.com/Tencent/spring-cloud-tencent/pull/1262)
99
- [fix: fix the lossless provider override in multiple registries scenario](https://github.com/Tencent/spring-cloud-tencent/pull/1263)
10-
- [fix:fix nearby router properties loading bug.](https://github.com/Tencent/spring-cloud-tencent/pull/1272)
10+
- [fix:fix nearby router properties loading bug.](https://github.com/Tencent/spring-cloud-tencent/pull/1272)
11+
- [fix:fix the ratelimit bug for 2023](https://github.com/Tencent/spring-cloud-tencent/pull/1316)

spring-cloud-starter-tencent-polaris-ratelimit/src/main/java/com/tencent/cloud/polaris/ratelimit/filter/QuotaCheckReactiveFilter.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
127127
if (Objects.nonNull(quotaResponse.getActiveRule())) {
128128
try {
129129
String encodedActiveRuleName = URLEncoder.encode(
130-
quotaResponse.getActiveRule().getName().getValue(), UTF_8);
130+
quotaResponse.getActiveRuleName(), UTF_8);
131131
response.getHeaders().add(HeaderConstant.INTERNAL_ACTIVE_RULE_NAME, encodedActiveRuleName);
132132
}
133133
catch (UnsupportedEncodingException e) {
134134
LOG.error("Cannot encode {} for header internal-callee-activerule.",
135-
quotaResponse.getActiveRule().getName().getValue(), e);
135+
quotaResponse.getActiveRuleName(), e);
136136
}
137137
}
138138
return response.writeWith(Mono.just(dataBuffer));

spring-cloud-starter-tencent-polaris-ratelimit/src/main/java/com/tencent/cloud/polaris/ratelimit/filter/QuotaCheckServletFilter.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ protected void doFilterInternal(@NonNull HttpServletRequest request, @NonNull Ht
119119
if (Objects.nonNull(quotaResponse.getActiveRule())) {
120120
try {
121121
String encodedActiveRuleName = URLEncoder.encode(
122-
quotaResponse.getActiveRule().getName().getValue(), UTF_8);
122+
quotaResponse.getActiveRuleName(), UTF_8);
123123
response.addHeader(HeaderConstant.INTERNAL_ACTIVE_RULE_NAME, encodedActiveRuleName);
124124
}
125125
catch (UnsupportedEncodingException e) {
126126
LOG.error("Cannot encode {} for header internal-callee-activerule.",
127-
quotaResponse.getActiveRule().getName().getValue(), e);
127+
quotaResponse.getActiveRuleName(), e);
128128
}
129129
}
130130
return;

0 commit comments

Comments
 (0)