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

Unified Diff: tools/telemetry/third_party/gsutilz/third_party/apitools/apitools/base/py/util.py

Issue 1376593003: Roll gsutil version to 4.15. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
Index: tools/telemetry/third_party/gsutilz/third_party/apitools/apitools/base/py/util.py
diff --git a/tools/telemetry/third_party/gsutilz/third_party/apitools/apitools/base/py/util.py b/tools/telemetry/third_party/gsutilz/third_party/apitools/apitools/base/py/util.py
old mode 100755
new mode 100644
index 779dd97f13dce1d5f076118b66accb3e3666974c..b92c9f8a43898dd6081607ee52aba1581933b048
--- a/tools/telemetry/third_party/gsutilz/third_party/apitools/apitools/base/py/util.py
+++ b/tools/telemetry/third_party/gsutilz/third_party/apitools/apitools/base/py/util.py
@@ -126,20 +126,17 @@ def CalculateWaitForRetry(retry_attempt, max_wait=60):
Args:
retry_attempt: Retry attempt counter.
- max_wait: Upper bound for wait time.
+ max_wait: Upper bound for wait time [seconds].
Returns:
- Amount of time to wait before retrying request.
+ Number of seconds to wait before retrying request.
"""
wait_time = 2 ** retry_attempt
- # randrange requires a nonzero interval, so we want to drop it if
- # the range is too small for jitter.
- if retry_attempt:
- max_jitter = (2 ** retry_attempt) / 2
- wait_time += random.randrange(-max_jitter, max_jitter)
- return min(wait_time, max_wait)
+ max_jitter = wait_time / 4.0
+ wait_time += random.uniform(-max_jitter, max_jitter)
+ return max(1, min(wait_time, max_wait))
def AcceptableMimeType(accept_patterns, mime_type):

Powered by Google App Engine
This is Rietveld 408576698