Fix broken loop in TestDocumentsWriterStallControl.assertState() (#13062)

The loop in assertState prematurely exists due to a broken break steament.

Closes #13061
This commit is contained in:
Simon Willnauer 2024-02-01 12:44:50 +01:00 committed by GitHub
parent ed826f26df
commit 3d47a0d5c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 14 deletions

View File

@ -174,22 +174,17 @@ public class TestDocumentsWriterStallControl extends LuceneTestCase {
DocumentsWriterStallControl ctrl) DocumentsWriterStallControl ctrl)
throws InterruptedException { throws InterruptedException {
int millisToSleep = 100; int millisToSleep = 100;
while (true) { while (ctrl.hasBlocked() && ctrl.isHealthy()) {
if (ctrl.hasBlocked() && ctrl.isHealthy()) { for (int n = numReleasers + numStallers; n < numReleasers + numStallers + numWaiters; n++) {
for (int n = numReleasers + numStallers; n < numReleasers + numStallers + numWaiters; n++) { if (ctrl.isThreadQueued(threads[n])) {
if (ctrl.isThreadQueued(threads[n])) { if (millisToSleep < 60000) {
if (millisToSleep < 60000) { Thread.sleep(millisToSleep);
Thread.sleep(millisToSleep); millisToSleep *= 2;
millisToSleep *= 2; break;
break; } else {
} else { fail("control claims no stalled threads but waiter seems to be blocked ");
fail("control claims no stalled threads but waiter seems to be blocked ");
}
} }
} }
break;
} else {
break;
} }
} }
} }