Skip to content

Commit e2f8e78

Browse files
update sleep to be very small -- any amount of time is sufficient
1 parent 4d030c9 commit e2f8e78

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

server/src/test/java/org/elasticsearch/common/util/concurrent/TaskExecutionTimeTrackingEsThreadPoolExecutorTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.elasticsearch.test.ESTestCase;
1818
import org.elasticsearch.threadpool.ThreadPool;
1919

20+
import java.time.Duration;
2021
import java.util.List;
2122
import java.util.concurrent.CountDownLatch;
2223
import java.util.concurrent.CyclicBarrier;
@@ -462,8 +463,8 @@ long getQueueTimeNanos() {
462463
*/
463464
private static void waitForTimeToElapse() throws InterruptedException {
464465
final var startNanoTime = System.nanoTime();
465-
while (TimeUnit.MILLISECONDS.convert(System.nanoTime() - startNanoTime, TimeUnit.NANOSECONDS) <= 100) {
466-
Thread.sleep(100);
466+
while ((System.nanoTime() - startNanoTime) < 1) {
467+
Thread.sleep(Duration.ofNanos(1));
467468
}
468469
}
469470
}

0 commit comments

Comments
 (0)