| OLD | NEW |
| 1 # Copyright 2013 The LUCI Authors. All rights reserved. | 1 # Copyright 2013 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 """Classes and functions for generic network communication over HTTP.""" | 5 """Classes and functions for generic network communication over HTTP.""" |
| 6 | 6 |
| 7 import cookielib | 7 import cookielib |
| 8 import cStringIO as StringIO | 8 import cStringIO as StringIO |
| 9 import datetime | 9 import datetime |
| 10 import httplib | 10 import httplib |
| 11 import itertools | 11 import itertools |
| 12 import json | 12 import json |
| 13 import logging | 13 import logging |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 attemp_obj = RetryAttempt(attempt, remaining) | 860 attemp_obj = RetryAttempt(attempt, remaining) |
| 861 yield attemp_obj | 861 yield attemp_obj |
| 862 if attemp_obj.skip_sleep: | 862 if attemp_obj.skip_sleep: |
| 863 continue | 863 continue |
| 864 # Only sleep if we are going to try again. | 864 # Only sleep if we are going to try again. |
| 865 if max_attempts and attempt != max_attempts - 1: | 865 if max_attempts and attempt != max_attempts - 1: |
| 866 remaining = (timeout - (current_time() - start)) if timeout else None | 866 remaining = (timeout - (current_time() - start)) if timeout else None |
| 867 if remaining is not None and remaining < 0: | 867 if remaining is not None and remaining < 0: |
| 868 break | 868 break |
| 869 sleep_before_retry(attempt, remaining) | 869 sleep_before_retry(attempt, remaining) |
| OLD | NEW |