Chromium Code Reviews| Index: parallel_emerge |
| diff --git a/parallel_emerge b/parallel_emerge |
| index ab342334c2e1d4e7a766d81e95fc2e123b46a888..f2ece3e05e8e5d160132a771f82b6f16fef56f4a 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,7 +683,10 @@ class DepGraphGenerator(object): |
| try: |
| return urllib2.urlopen(url) |
| except urllib2.HTTPError as e: |
| - raise |
| + if i + 1 == tries or e.code < 500: |
|
sosa
2010/11/16 18:09:25
use >= in case
|
| + raise |
| + else: |
| + print "Cannot GET %s: %s" % (url, e) |
|
sosa
2010/11/16 18:09:25
Adding a retrying message and you should probably
|
| except urllib2.URLError as e: |
| if i + 1 == tries: |
| raise |