Skip to content

Commit

Permalink
Ratelimiting should only log when a request is actually rate-limited (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
magibney authored May 16, 2024
1 parent 1c904a0 commit 9892b9b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions solr/core/src/java/org/apache/solr/servlet/ServletUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ static void rateLimitRequest(
Runnable limitedExecution)
throws ServletException, IOException {
try (RequestRateLimiter.SlotReservation accepted = rateLimitManager.handleRequest(request)) {
if (log.isInfoEnabled()) {
log.info("rate limit request {}", request.getRequestURI());
}
if (accepted == null) {
if (log.isInfoEnabled()) {
log.info("rate limit request {}", request.getRequestURI());
}
response.sendError(ErrorCode.TOO_MANY_REQUESTS.code, RateLimitManager.ERROR_MESSAGE);
return;
}
Expand Down

0 comments on commit 9892b9b

Please sign in to comment.