You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have method wrapped in @retry() and want to change the params of the retry elsewhere using .retry_with(), you need to provide the class instance again. Here is a simple reproducer:
import tenacity
from datetime import datetime
class TestClass:
@tenacity.retry(wait=tenacity.wait_fixed(5), stop=tenacity.stop_after_delay(10))
def test(self, a):
print(datetime.now(), a)
raise Exception()
t = TestClass()
print(t.test.retry_with(wait=tenacity.wait_fixed(2), stop=tenacity.stop_after_delay(10)))
print(t.test)
# Usage of original retry is simple, does not need to provide "t" instance at all
t.test("OK")
# This should not need class instance "t" again
t.test.retry_with(wait=tenacity.wait_fixed(1), stop=tenacity.stop_after_delay(3))(t, a="OK")
The prints should be the same, but they are not:
<function TestClass.test at 0x7fa403015760>
<bound method TestClass.test of <__main__.TestClass object at 0x7fa4025c0990>>
The text was updated successfully, but these errors were encountered:
Hi,
If you have method wrapped in
@retry()
and want to change the params of the retry elsewhere using.retry_with()
, you need to provide the class instance again. Here is a simple reproducer:The
prints
should be the same, but they are not:The text was updated successfully, but these errors were encountered: