LGTM, thanks.

On Thu, Sep 19, 2013 at 6:21 PM, Klaus Aehlig <[email protected]> wrote:

> 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: Klaus Aehlig <[email protected]>
> ---
>  lib/utils/retry.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/utils/retry.py b/lib/utils/retry.py
> index cc7541c..12d1014 100644
> --- a/lib/utils/retry.py
> +++ b/lib/utils/retry.py
> @@ -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:
>        wait_fn(remaining_time)
> --
> 1.8.4
>
>


-- 
Thomas Thrainer | Software Engineer | [email protected] |

Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to