You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "paulirwin (via GitHub)" <gi...@apache.org> on 2026/07/12 02:52:05 UTC

[PR] Backport RateLimiter fixes from Lucene 4.8.1, #1381 [lucenenet]

paulirwin opened a new pull request, #1420:
URL: https://github.com/apache/lucenenet/pull/1420

   - [X] You've read the [Contributor Guide](https://github.com/apache/lucenenet/blob/master/CONTRIBUTING.md) and [Code of Conduct](https://www.apache.org/foundation/policies/conduct.html).
   - [X] You've included unit or integration tests for your change, where applicable.
   - [X] You've included inline docs for your change, where applicable.
   - [X] There's an open issue for the PR that you are making. If you'd like to propose a change, please [open an issue](https://github.com/apache/lucenenet/issues/new/choose) to discuss the change or find an existing issue.
   
   Backport RateLimiter fixes from Lucene 4.8.1
   
   Partial #1381 (Batch 2)
   
   ## Description
   
   This backports the LUCENE-5641 RateLimiter fix from Lucene 4.8.1. The original impetus for this fix in Lucene was not a problem in .NET because we were already doing the integer division correctly, but this does fix a race by synchronizing around the logic too. So it's worth backporting for that, as well as to stay in sync with upstream. And, this adds a test as well.
   
   See this comment for some more context: https://github.com/apache/lucenenet/issues/1381#issuecomment-4949561558
   


-- 
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: dev-unsubscribe@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Backport RateLimiter fixes from Lucene 4.8.1, #1381 [lucenenet]

Posted by "paulirwin (via GitHub)" <gi...@apache.org>.
paulirwin commented on PR #1420:
URL: https://github.com/apache/lucenenet/pull/1420#issuecomment-4949732985

   An update... there was the potential for this test to be flaky (per its own comment in Java). I ran it many times on my machine and it was passing reliably, but there was the possibility (particularly on slow ADO agents I would presume) for this to possibly fail due to timing. It turns out there were subsequent updates to this test in Lucene 6.0.0 and Lucene 7.0.0 in commits 090b804 and a893aaa that improved the reliability of this test on slow machines, so I went ahead and backported those as well.


-- 
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: dev-unsubscribe@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Port RateLimiter fixes from Lucene 4.8.1, #1381 [lucenenet]

Posted by "paulirwin (via GitHub)" <gi...@apache.org>.
paulirwin merged PR #1420:
URL: https://github.com/apache/lucenenet/pull/1420


-- 
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: dev-unsubscribe@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Port RateLimiter fixes from Lucene 4.8.1, #1381 [lucenenet]

Posted by "NightOwl888 (via GitHub)" <gi...@apache.org>.
NightOwl888 commented on code in PR #1420:
URL: https://github.com/apache/lucenenet/pull/1420#discussion_r3889771643


##########
src/Lucene.Net.Tests/Store/TestRateLimiter.cs:
##########
@@ -46,5 +52,67 @@ public void TestPause()
             Assert.IsTrue(convert < 2000L, "we should sleep less than 2 seconds but did: " + convert + " millis");
             Assert.IsTrue(convert > 1000L, "we should sleep at least 1 second but did only: " + convert + " millis");
         }
+
+        [Test]
+        public void TestThreads()
+        {
+            double targetMBPerSec = 10.0 + 20 * Random.NextDouble();
+            SimpleRateLimiter limiter = new SimpleRateLimiter(targetMBPerSec);
+
+            CountdownLatch startingGun = new CountdownLatch(1);

Review Comment:
   Please add a `using` block here.



-- 
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: dev-unsubscribe@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org