Commit 34098a73 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Fix corner-case in handling of remaining retry time

Consider a remaining time of 0 as already timed out. Otherwise,
there is no guarantee that calling utils.Retry with timeout 0
will call the function precisely once; it might run in time
shorter than the resolution of timer.
Signed-off-by: default avatarKlaus Aehlig <>
Reviewed-by: default avatarThomas Thrainer <>
parent 80adbbe1
......@@ -170,11 +170,11 @@ def Retry(fn, delay, timeout, args=None, wait_fn=time.sleep,
remaining_time = end_time - _time_fn()
if remaining_time < 0.0:
if remaining_time <= 0.0:
# pylint: disable=W0142
raise RetryTimeout(*retry_args)
assert remaining_time >= 0.0
assert remaining_time > 0.0
if calc_delay is None:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment