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

Wrapped function executes much more than timeout #12

Open
matroskin8 opened this issue Feb 22, 2019 · 0 comments
Open

Wrapped function executes much more than timeout #12

matroskin8 opened this issue Feb 22, 2019 · 0 comments

Comments

@matroskin8
Copy link
Contributor

matroskin8 commented Feb 22, 2019

Let's create file t.py

from time import sleep

import retry


def foo():
    sleep(5)
    assert False


retry.retry(interval=0, timeout=1)(foo)()

then

$ time python3 t.py 
Exception experienced when trying function foo
Traceback (most recent call last):
  File "/home/vvitsukaev/PycharmProjects/retry.it/retry.py", line 89, in wrapper
    result = run_func()
  File "<timeit-src>", line 8, in foo
  File "/home/vvitsukaev/PycharmProjects/retry.it/retry.py", line 25, in __internal_timeout
    raise MaximumTimeoutExceeded(msg)
retry.MaximumTimeoutExceeded: Maximum timeout of 1s reached for function foo
Retrying foo in 0s...
Exception experienced when trying function foo
Traceback (most recent call last):
  File "/home/vvitsukaev/PycharmProjects/retry.it/retry.py", line 89, in wrapper
    result = run_func()
  File "<timeit-src>", line 9, in foo
AssertionError
Retrying foo in 0s...
Exception experienced when trying function foo
Traceback (most recent call last):
  File "/home/vvitsukaev/PycharmProjects/retry.it/retry.py", line 89, in wrapper
    result = run_func()
  File "<timeit-src>", line 9, in foo
AssertionError
Retrying foo in 0s...
Exception experienced when trying function foo
Traceback (most recent call last):
  File "/home/vvitsukaev/PycharmProjects/retry.it/retry.py", line 89, in wrapper
    result = run_func()
  File "<timeit-src>", line 9, in foo
AssertionError
Retrying foo in 0s...
Exception experienced when trying function foo
Traceback (most recent call last):
  File "/home/vvitsukaev/PycharmProjects/retry.it/retry.py", line 89, in wrapper
    result = run_func()
  File "<timeit-src>", line 9, in foo
AssertionError
Retrying foo in 0s...
Exception experienced when trying function foo
Traceback (most recent call last):
  File "/home/vvitsukaev/PycharmProjects/retry.it/retry.py", line 89, in wrapper
    result = run_func()
  File "<timeit-src>", line 9, in foo
AssertionError
Retrying foo in 0s...
Exception experienced when trying function foo
Traceback (most recent call last):
  File "/home/vvitsukaev/PycharmProjects/retry.it/retry.py", line 89, in wrapper
    result = run_func()
  File "<timeit-src>", line 9, in foo
AssertionError
Retrying foo in 0s...
Exception experienced when trying function foo
Traceback (most recent call last):
  File "/home/vvitsukaev/PycharmProjects/retry.it/retry.py", line 89, in wrapper
    result = run_func()
  File "<timeit-src>", line 9, in foo
AssertionError
Retrying foo in 0s...
Exception experienced when trying function foo
Traceback (most recent call last):
  File "/home/vvitsukaev/PycharmProjects/retry.it/retry.py", line 89, in wrapper
    result = run_func()
  File "<timeit-src>", line 9, in foo
AssertionError
Retrying foo in 0s...
Exception experienced when trying function foo
Traceback (most recent call last):
  File "/home/vvitsukaev/PycharmProjects/retry.it/retry.py", line 89, in wrapper
    result = run_func()
  File "<timeit-src>", line 9, in foo
AssertionError

real	0m46.082s
user	0m0.044s
sys	0m0.013s

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

1 participant