noblepaul commented on code in PR #2522:
URL: https://github.com/apache/solr/pull/2522#discussion_r1650864722
##########
solr/core/src/test/org/apache/solr/servlet/TestRequestRateLimiter.java:
##########
@@ -282,4 +289,130 @@ public RateLimitManager build() {
return rateLimitManager;
}
}
+
+ @Test
+ @SuppressWarnings("try")
+ public void testAdjustingConfig()
+ throws IOException, InterruptedException, ExecutionException,
TimeoutException {
+ Random r = random();
+ int maxAllowed = 32;
+ int allowed = r.nextInt(maxAllowed) + 1;
+ int guaranteed = r.nextInt(allowed + 1);
+ int borrowLimit = allowed - guaranteed;
+ RateLimiterConfig config =
+ new RateLimiterConfig(
+ SolrRequest.SolrRequestType.QUERY,
+ true,
+ guaranteed,
+ 20,
+ allowed /* allowedRequests */,
+ true /* isSlotBorrowing */);
+ RequestRateLimiter limiter = new RequestRateLimiter(config);
+ ExecutorService exec = ExecutorUtil.newMDCAwareCachedThreadPool("tests");
+ try (Closeable c = () -> ExecutorUtil.shutdownAndAwaitTermination(exec)) {
+ for (int j = 0; j < 5; j++) {
+ System.err.println("for " + allowed + "/" + guaranteed);
Review Comment:
is this a debug statement? Shouldn't we use logger ?
--
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]