-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use higher precision time source in retry decorator/tests
Despite my best efforts to account for Windows' coarse timer precision, the test_retry_wait tests are still randomly failing as it isn't sleeping for long enough by a small margin: Example 1: 472.171 - 472.156 >= 0.015 (~1% too low) Example 2: 554.406 - 554.265 >= 0.15 (~7% too low) (call_time, test_start_time >= expected sleep duration between retries) To avoid these random failures, I've adjusted the required sleep duration to be 10% less which should be enough. I've also replaced time.monotonic() with time.perf_counter() in the retry utility and test suite since it's effectively monotonic[^1] while providing much higher resolution (esp. on Windows). [^1]: It's not guaranteed to be monotonic in the Python docs, but it is _indeed_ monotonic on all platforms we care abouti.
- Loading branch information
Showing
2 changed files
with
21 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters