add limit rate filter debug log (#417)

Co-authored-by: rod.xu <rod.xu@yunlsp.com>
Co-authored-by: Haotian Zhang <928016560@qq.com>
pull/428/head
许路路 2 years ago committed by GitHub
parent d99e99583c
commit c347054f40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,3 +2,4 @@
---
- [Bugfix: optimize ratelimit actuator](https://github.com/Tencent/spring-cloud-tencent/pull/413)
- [Feature: add rate limit filter debug log](https://github.com/Tencent/spring-cloud-tencent/pull/417)

@ -114,6 +114,7 @@ public class QuotaCheckReactiveFilter implements WebFilter, Ordered {
}
// Unirate
if (quotaResponse.getCode() == QuotaResultCode.QuotaResultOk && quotaResponse.getWaitMs() > 0) {
LOG.debug("The request of [{}] will waiting for {}ms.", path, quotaResponse.getWaitMs());
return Mono.delay(Duration.ofMillis(quotaResponse.getWaitMs())).flatMap(e -> chain.filter(exchange));
}
}

@ -110,6 +110,7 @@ public class QuotaCheckServletFilter extends OncePerRequestFilter {
}
// Unirate
if (quotaResponse.getCode() == QuotaResultCode.QuotaResultOk && quotaResponse.getWaitMs() > 0) {
LOG.debug("The request of [{}] will waiting for {}ms.", request.getRequestURI(), quotaResponse.getWaitMs());
Thread.sleep(quotaResponse.getWaitMs());
}

Loading…
Cancel
Save