Actions
Bug #9141
open[SDKs] Bad use of RetryLoop in events.py
Story points:
-
Release:
Release relationship:
Auto
Description
This is a common idiom in events.py
:
for tries_left in RetryLoop(...):
...
if tries_left == 0:
_logger.exception("Everything is terrible")
...
There are two bugs in this pattern.
First, if the body of the RetryLoop succeeds on the last attempt, tries_left == 0
will be true, and it will be incorrectly treated as a failure.
Second, no exception is being handled at the time we call _logger.exception()
. Testing suggests that in this case, it just writes "None" where it would normally write a traceback. That's not helping anybody, so we should call a different logging method.
Separately from that, there are two times when the body of the RetryLoop is:
try:
items = self.api.[some method].execute()
break
except errors.ApiError as error:
pass
else:
tries_left = 0
break
break
immediately breaks the control flow, so the else:
block will never run. Was that supposed to be except Exception:
instead?
Updated by Brett Smith over 8 years ago
- Target version set to Arvados Future Sprints
Updated by Ward Vandewege over 3 years ago
- Target version deleted (
Arvados Future Sprints)
Actions