Revision 506be7c5 lib/utils.py
b/lib/utils.py | ||
---|---|---|
2499 | 2499 |
"""Retry loop timed out. |
2500 | 2500 |
|
2501 | 2501 |
""" |
2502 |
def RaiseInner(self): |
|
2503 |
if self.args and isinstance(self.args[0], Exception): |
|
2504 |
raise self.args[0] |
|
2505 |
else: |
|
2506 |
raise RetryTimeout(*self.args) |
|
2502 | 2507 |
|
2503 | 2508 |
|
2504 | 2509 |
class RetryAgain(Exception): |
... | ... | |
2612 | 2617 |
assert calc_delay is None or callable(calc_delay) |
2613 | 2618 |
|
2614 | 2619 |
while True: |
2620 |
retry_args = [] |
|
2615 | 2621 |
try: |
2616 | 2622 |
# pylint: disable-msg=W0142 |
2617 | 2623 |
return fn(*args) |
2618 |
except RetryAgain: |
|
2619 |
pass
|
|
2624 |
except RetryAgain, err:
|
|
2625 |
retry_args = err.args
|
|
2620 | 2626 |
except RetryTimeout: |
2621 | 2627 |
raise errors.ProgrammerError("Nested retry loop detected that didn't" |
2622 | 2628 |
" handle RetryTimeout") |
... | ... | |
2624 | 2630 |
remaining_time = end_time - _time_fn() |
2625 | 2631 |
|
2626 | 2632 |
if remaining_time < 0.0: |
2627 |
raise RetryTimeout() |
|
2633 |
# pylint: disable-msg=W0142 |
|
2634 |
raise RetryTimeout(*retry_args) |
|
2628 | 2635 |
|
2629 | 2636 |
assert remaining_time >= 0.0 |
2630 | 2637 |
|
Also available in: Unified diff