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

stop_max_delay doesn't work as expected #56

Open
kalessin opened this issue Jul 8, 2016 · 1 comment
Open

stop_max_delay doesn't work as expected #56

kalessin opened this issue Jul 8, 2016 · 1 comment

Comments

@kalessin
Copy link

kalessin commented Jul 8, 2016

I am not sure how stop_max_delay is intended to work, but I would expect it would stop retry after have been retrying more than the given time with that parameter. However, actually it works very differently: it just disable retry if the script has been run for more than the given time. This can be easily reproduced with this script:

import time                                                                                                                                                                     
import sys 
from retrying import retry

def retry_on_exception(exception):
    print 'Retrying....'
    return True


@retry(retry_on_exception=retry_on_exception, stop_max_delay=10000, wait_fixed=1000)
def test(sleep):
    time.sleep(sleep)
    assert False


if __name__ == '__main__':
    test(int(sys.argv[1]))

if I run

python test.py 0

you will get 10 retries, one per second, as expected. In this case, the exception is raised as soon as the script starts, that is why the problem is not seen. However, if you run

python test.py 12

(so exception will be raised 12 seconds after the script started), you won't get any retry.

@alexyr
Copy link

alexyr commented Sep 14, 2017

It works like global timeout.
If your single try will be longer than stop_max_delay, it will not be executed again.

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

2 participants