Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WaitStrategies documentation should mention milliseconds #93

Open
novalis opened this issue Dec 16, 2019 · 0 comments
Open

WaitStrategies documentation should mention milliseconds #93

novalis opened this issue Dec 16, 2019 · 0 comments

Comments

@novalis
Copy link

novalis commented Dec 16, 2019

Consider WaitStrategies.fibonacciWait(3, TimeUnit.MINUTES) with StopStrategies.stopAfterAttempt(5). I would expect this to run with delays of something like 1 minute, 1 minutes, 2 minutes, 3 minutes. In fact, it runs with 1ms, 1ms, 2ms, and 3ms -- it never gets anywhere near 3 minutes.

The "multiplier" in WaitStrategies.fibonacciWait(long multiplier, long maximumTime, java.util.concurrent.TimeUnit maximumTimeUnit) is actually what these millisecond numbers get multiplied by.

The docs never mention milliseconds anywhere, so I am very confused to see them used.

On reflection, it makes sense that wait strategies are unrelated to stop strategies, and thus in general, wait strategies can't take into account how many tries are needed. So they need some sort of default.

But I do think that a doc change would help with this. I also think that "implicit milliseconds" is an error-prone API, especially when there is already a TimeUnit given. So I would love to see a new version of the API that computes incremental wait times based on the maximum wait time. Or some other API change to avoid the "implicit milliseconds" problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant