dsmiley commented on code in PR #1780:
URL: https://github.com/apache/solr/pull/1780#discussion_r1266137594
##########
solr/core/src/java/org/apache/solr/servlet/ServletUtils.java:
##########
@@ -216,16 +217,19 @@ static void rateLimitRequest(
}
if (!accepted) {
- String errorMessage =
- "Too many requests for this request type."
- + "Please try after some time or increase the quota for this
request type";
-
- response.sendError(429, errorMessage);
+ response.sendError(ErrorCode.TOO_MANY_REQUESTS.code,
RateLimitManager.ERROR_MESSAGE);
+ return;
}
+ needsCleanup = false;
// todo: this shouldn't be required, tracing and rate limiting should be
independently
// composable
traceHttpRequestExecution2(request, response, limitedExecution, trace);
} finally {
+ if (needsCleanup) {
+ consumeInputFully(request, response);
+ SolrRequestInfo.reset();
+ SolrRequestParsers.cleanupMultipartFiles(request);
Review Comment:
I'm happy to review around this code (here I am) so restructuring I think is
necessary first. @gus-asf might -- he brought about I'd current structure.
##########
solr/core/src/java/org/apache/solr/servlet/ServletUtils.java:
##########
@@ -216,16 +217,19 @@ static void rateLimitRequest(
}
if (!accepted) {
- String errorMessage =
- "Too many requests for this request type."
- + "Please try after some time or increase the quota for this
request type";
-
- response.sendError(429, errorMessage);
+ response.sendError(ErrorCode.TOO_MANY_REQUESTS.code,
RateLimitManager.ERROR_MESSAGE);
+ return;
}
+ needsCleanup = false;
// todo: this shouldn't be required, tracing and rate limiting should be
independently
// composable
traceHttpRequestExecution2(request, response, limitedExecution, trace);
} finally {
+ if (needsCleanup) {
+ consumeInputFully(request, response);
+ SolrRequestInfo.reset();
+ SolrRequestParsers.cleanupMultipartFiles(request);
Review Comment:
I'm happy to review around this code (here I am) so restructuring I think is
necessary first. @gus-asf might -- he brought about Iits current structure.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]