Wrapped function executes much more than timeout
matroskin8 opened this issue · 0 comments
matroskin8 commented
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