Skip to content

Commit

Permalink
Retry on conflict updating labels/annotations
Browse files Browse the repository at this point in the history
We retry up to 10 times, with a delay of 500ms between attempts.

This is necessary because OpenShift itself may be updating the Build
object as well.

Add debug logging of the object before modification, for clarification
of why the object is changing.

Signed-off-by: Tim Waugh <twaugh@redhat.com>
  • Loading branch information
twaugh committed Apr 3, 2017
1 parent 1629e5a commit cc709f3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions osbs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ def retry(*args, **kwargs):
raise

last_exception = ex
finally:
if attempt != 0:
logger.debug("retry: succeeded on attempt %d", attempt + 1)

raise last_exception or RuntimeError("operation not attempted")

Expand Down

0 comments on commit cc709f3

Please sign in to comment.