Avoid referenced before assignment in retry_on_conflict
Raising pure exception to avoid referenced before assignment error and actually see the exception. Change-Id: I86424d989a6ec343134f6fac3e777a9e3e59eef0
This commit is contained in:
parent
0cbe05eff6
commit
dc50890c2c
@ -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
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user