Commit 3cf028ea authored by Jao-ke Chin-Lee's avatar Jao-ke Chin-Lee Committed by Commit Bot

[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: 's avatarAndrii Shyshkalov <tandrii@chromium.org>
parent a21b5b31
......@@ -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
# which the target revision was polled, we retry some.
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
while not done:
name = sln['name']
......@@ -563,7 +567,9 @@ def git_checkout(solutions, revisions, shallow, refs, git_cache_dir,
# Exited abnormally, theres probably something wrong.
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
print 'Ran %s seconds past deadline. Aborting.' % overrun
raise
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment