We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c532444 commit 090b734Copy full SHA for 090b734
1 file changed
system_tests/retry.py
@@ -38,17 +38,20 @@ def __call__(self, to_wrap):
38
@wraps(to_wrap)
39
def wrapped_function(*args, **kwargs):
40
tries_counter = self.tries
41
+ exception = self.exception
42
+ delay = self.delay
43
+ backoff = self.backoff
44
while tries_counter > 0:
45
try:
46
return to_wrap(*args, **kwargs)
- except self.exception as caught_exception:
47
+ except exception as caught_exception:
48
msg = ("%s, Trying again in %d seconds..." %
- (str(caught_exception), self.delay))
49
+ (str(caught_exception), delay))
50
self.logger(msg)
51
- time.sleep(self.delay)
52
+ time.sleep(delay)
53
tries_counter -= 1
- self.delay *= self.backoff
54
+ delay *= backoff
55
56
57
return wrapped_function
0 commit comments