[bot_update] Only kick in deadline after the first try.

If the revision has not yet propagated, then we never retry, because the amount of time to fetch HEAD already exceeds the deadline.

Bug: 771007
Change-Id: I91ac30b2b53b4f75729357b3298c52856a4d350e
Reviewed-on: https://chromium-review.googlesource.com/729328
Commit-Queue: Jao-ke Chin-Lee <jchinlee@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
changes/28/729328/4
Jao-ke Chin-Lee 8 years ago committed by Commit Bot
parent a21b5b314b
commit 3cf028ea0f

@ -505,7 +505,11 @@ def git_checkout(solutions, revisions, shallow, refs, git_cache_dir,
# Just in case we're hitting a different git server than the one from # Just in case we're hitting a different git server than the one from
# which the target revision was polled, we retry some. # which the target revision was polled, we retry some.
done = False done = False
deadline = time.time() + 60 # One minute (5 tries with exp. backoff).
# One minute (5 tries with exp. backoff). We retry at least once regardless
# of deadline in case initial fetch takes longer than the deadline but does
# not contain the required revision.
deadline = time.time() + 60
tries = 0 tries = 0
while not done: while not done:
name = sln['name'] name = sln['name']
@ -563,7 +567,9 @@ def git_checkout(solutions, revisions, shallow, refs, git_cache_dir,
# Exited abnormally, theres probably something wrong. # Exited abnormally, theres probably something wrong.
print 'Something failed: %s.' % str(e) print 'Something failed: %s.' % str(e)
if time.time() > deadline: # Only kick in deadline after trying once, in case the revision hasn't
# yet propagated.
if tries >= 1 and time.time() > deadline:
overrun = time.time() - deadline overrun = time.time() - deadline
print 'Ran %s seconds past deadline. Aborting.' % overrun print 'Ran %s seconds past deadline. Aborting.' % overrun
raise raise

Loading…
Cancel
Save