Skip to content

Commit

Permalink
Choose lower time
Browse files Browse the repository at this point in the history
Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
  • Loading branch information
harshavamsi committed Sep 5, 2024
1 parent 7fa5cc5 commit 3a5e714
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ public static void assertBusy(CheckedRunnable<Exception> codeBlock) throws Excep
* Runs the code block for the provided interval, waiting for no assertions to trip.
*/
public static void assertBusy(CheckedRunnable<Exception> codeBlock, long maxWaitTime, TimeUnit unit) throws Exception {
maxWaitTime = 5;
if ((unit.equals(TimeUnit.SECONDS) && maxWaitTime > 5) || unit.equals(TimeUnit.MINUTES)) maxWaitTime = 5;
long maxTimeInMillis = TimeUnit.MILLISECONDS.convert(maxWaitTime, unit);
// In case you've forgotten your high-school studies, log10(x) / log10(y) == log y(x)
long iterations = Math.max(Math.round(Math.log10(maxTimeInMillis) / Math.log10(2)), 1);
Expand Down

0 comments on commit 3a5e714

Please sign in to comment.