Skip to content

Commit

Permalink
Reduce the initial wait in eventually()
Browse files Browse the repository at this point in the history
  • Loading branch information
danberindei committed Nov 8, 2016
1 parent abb0551 commit 1db88dd
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,9 @@ protected void eventually(Supplier<String> messageSupplier, BooleanSupplier cond
TimeUnit timeUnit) {
try {
long timeoutNanos = timeUnit.toNanos(timeout);
// We want 10 loops with the sleep time increasing in arithmetic progression
int loops = 10;
// We want the sleep time to increase in arithmetic progression
// 30 loops with the default timeout of 30 seconds means the initial wait is ~ 65 millis
int loops = 30;
int progressionSum = loops * (loops + 1) / 2;
long initialSleepNanos = timeoutNanos / progressionSum;
long sleepNanos = initialSleepNanos;
Expand Down

0 comments on commit 1db88dd

Please sign in to comment.