madrob commented on a change in pull request #1606: URL: https://github.com/apache/lucene-solr/pull/1606#discussion_r445647072
########## File path: solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java ########## @@ -289,6 +295,23 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw rb.requestInfo.setResponseBuilder(rb); } + //TODO: Should this be for indexing requests as well? + CircuitBreakerManager circuitBreakerManager = req.getCore().getCircuitBreakerManager(); + Map<CircuitBreakerType, CircuitBreaker> trippedCircuitBreakers = circuitBreakerManager.checkAllCircuitBreakers(); + + if (trippedCircuitBreakers != null) { + final RTimerTree timer = rb.isDebug() ? req.getRequestTimer() : null; + + if (timer != null) { + RTimerTree subt = timer.sub("circuitbreaker"); + rb.setTimer(subt.sub("circuitbreaker")); + } + String errorMessage = CircuitBreakerManager.constructFinalErrorMessageString(trippedCircuitBreakers); + rsp.add(STATUS, FAILURE); + rsp.setException(new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE, "Circuit Breakers tripped " + errorMessage)); Review comment: Coming back to this, yea, I think 503 is best. I was thinking maybe 429, but this is probably good. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org