Skip to content

Commit 090b734

Browse files
committed
Scoping the settings.
1 parent c532444 commit 090b734

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

system_tests/retry.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,20 @@ def __call__(self, to_wrap):
3838
@wraps(to_wrap)
3939
def wrapped_function(*args, **kwargs):
4040
tries_counter = self.tries
41+
exception = self.exception
42+
delay = self.delay
43+
backoff = self.backoff
4144
while tries_counter > 0:
4245
try:
4346
return to_wrap(*args, **kwargs)
44-
except self.exception as caught_exception:
47+
except exception as caught_exception:
4548
msg = ("%s, Trying again in %d seconds..." %
46-
(str(caught_exception), self.delay))
49+
(str(caught_exception), delay))
4750
self.logger(msg)
4851

49-
time.sleep(self.delay)
52+
time.sleep(delay)
5053
tries_counter -= 1
51-
self.delay *= self.backoff
54+
delay *= backoff
5255
return to_wrap(*args, **kwargs)
5356

5457
return wrapped_function

0 commit comments

Comments
 (0)