| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Provides functions to work with AppEngine endpoints""" | 5 """Provides functions to work with AppEngine endpoints""" |
| 6 | 6 |
| 7 import httplib2 | 7 import httplib2 |
| 8 import logging | 8 import logging |
| 9 import time | 9 import time |
| 10 | 10 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 try: | 70 try: |
| 71 return request.execute() | 71 return request.execute() |
| 72 except apiclient.errors.HttpError as e: | 72 except apiclient.errors.HttpError as e: |
| 73 # This retries internal server (500, 503) and quota (403) errors. | 73 # This retries internal server (500, 503) and quota (403) errors. |
| 74 # TODO(sergiyb): Figure out if we still need to retry 403 errors. They | 74 # TODO(sergiyb): Figure out if we still need to retry 403 errors. They |
| 75 # were used by codesite to fail on quota errors, but it is unclear whether | 75 # were used by codesite to fail on quota errors, but it is unclear whether |
| 76 # Monorail uses same logic or not. | 76 # Monorail uses same logic or not. |
| 77 if tries == num_tries or e.resp.status not in [403, 500, 503]: | 77 if tries == num_tries or e.resp.status not in [403, 500, 503]: |
| 78 raise | 78 raise |
| 79 time.sleep(2 ** (tries - 1)) | 79 time.sleep(2 ** (tries - 1)) |
| OLD | NEW |