atris commented on a change in pull request #1686:
URL: https://github.com/apache/lucene-solr/pull/1686#discussion_r467110274



##########
File path: solr/core/src/java/org/apache/solr/servlet/RequestRateLimiter.java
##########
@@ -58,18 +58,18 @@ public RequestRateLimiter(RateLimiterConfig 
rateLimiterConfig) {
   public Pair<Boolean, AcquiredSlotMetadata> handleRequest() throws 
InterruptedException {
 
     if (!rateLimiterConfig.isEnabled) {
-      return new Pair<Boolean, AcquiredSlotMetadata>(true, null);
+      return new Pair<Boolean, AcquiredSlotMetadata>(true, new 
AcquiredSlotMetadata(null, null));
     }
 
     if 
(guaranteedSlotsPool.tryAcquire(rateLimiterConfig.waitForSlotAcquisition, 
TimeUnit.MILLISECONDS)) {
-      return new Pair<Boolean, AcquiredSlotMetadata>(true, new 
AcquiredSlotMetadata(this, false));
+      return new Pair<Boolean, AcquiredSlotMetadata>(true, new 
AcquiredSlotMetadata(this, guaranteedSlotsPool));
     }
 
     if 
(borrowableSlotsPool.tryAcquire(rateLimiterConfig.waitForSlotAcquisition, 
TimeUnit.MILLISECONDS)) {
-      return new Pair<Boolean, AcquiredSlotMetadata>(true, new 
AcquiredSlotMetadata(this, true));
+      return new Pair<Boolean, AcquiredSlotMetadata>(true, new 
AcquiredSlotMetadata(this, borrowableSlotsPool));
     }
 
-    return new Pair<Boolean, AcquiredSlotMetadata>(false, null);
+    return new Pair<Boolean, AcquiredSlotMetadata>(false, new 
AcquiredSlotMetadata(null, null));
   }

Review comment:
       We need the rate limiter to be a part of the returned value here so that 
the decrement can be invoked on the right RequestRateLimiter?




----------------------------------------------------------------
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

Reply via email to