You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
0 commit comments