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

Unified Diff: build/http_download.py

Issue 6880339: Small cosmetic change - simplify retry logic (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 9 years, 8 months 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 | « build/download_utils.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/http_download.py
===================================================================
--- build/http_download.py (revision 5079)
+++ build/http_download.py (working copy)
@@ -72,8 +72,9 @@
urllib2.install_opener(opener)
_CreateDirectory(os.path.split(target)[0])
# Retry up to 10 times (appengine logger is flaky).
- retries = 10
- for i in range(retries):
+ for i in xrange(10):
+ if i:
+ sys.stdout.write('Download failed on %s, retrying... (%d)\n' % (url, i))
try:
src = urllib2.urlopen(url)
try:
@@ -83,8 +84,7 @@
src.close()
break
except urllib2.HTTPError:
- if i < retries - 1:
- sys.stdout.write('Download failed on %s, retrying... (%d)\n' % (url, i))
- continue
- sys.stdout.write('Download failed on %s, giving up.\n' % url)
- raise
+ pass
+ else:
+ sys.stdout.write('Download failed on %s, giving up.\n' % url)
+ raise
« no previous file with comments | « build/download_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698