Merge "Avoid referenced before assignment in retry_on_conflict"

This commit is contained in:
Zuul 2019-12-18 02:21:59 +00:00 committed by Gerrit Code Review
commit d661df845d

View File

@ -34,14 +34,13 @@ def retry_on_conflict(func):
def inner(*args, **kwargs):
# TODO(vsaienko): make number of retries and delay between
# them configurable in future.
e = None
for att in range(10):
try:
return func(*args, **kwargs)
except lib_exc.Conflict as e:
except lib_exc.Conflict:
if att == 9:
raise
time.sleep(1)
raise lib_exc.Conflict(e)
return inner