Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: parallel_emerge

Issue 5056003: Retry in parallel_emerge for 5xx error codes. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: Add explicit conversion for better error messages. Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: parallel_emerge
diff --git a/parallel_emerge b/parallel_emerge
index ab342334c2e1d4e7a766d81e95fc2e123b46a888..c912a115ac000207582caa693c4997e429764990 100755
--- a/parallel_emerge
+++ b/parallel_emerge
@@ -667,9 +667,10 @@ class DepGraphGenerator(object):
return {}
def retry_urlopen(url, tries=3):
- """Open the specified url, retrying if we run into network errors.
+ """Open the specified url, retrying if we run into temporary errors.
- We do not retry for HTTP errors.
+ We retry for both network errors and 5xx Server Errors. We do not retry
+ for HTTP errors with a non-5xx code.
Args:
url: The specified url.
@@ -682,12 +683,17 @@ class DepGraphGenerator(object):
try:
return urllib2.urlopen(url)
except urllib2.HTTPError as e:
- raise
+ if i + 1 >= tries or e.code < 500:
+ raise
+ else:
+ print "Cannot GET %s: %s" % (url, str(e))
except urllib2.URLError as e:
- if i + 1 == tries:
+ if i + 1 >= tries:
raise
else:
- print "Cannot GET %s: %s" % (url, e)
+ print "Cannot GET %s: %s" % (url, str(e))
+ print "Sleeping for 10 seconds before retrying..."
+ time.sleep(10)
url = os.path.join(binhost_url, "Packages")
try:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698