add wait on delay (#794)

This commit is contained in:
Nick Lang
2018-05-18 14:30:31 -06:00
committed by GitHub
parent 206e0d609c
commit 7751fede5a
+5 -1
View File
@@ -294,7 +294,7 @@ class Transport(object):
if body is not None:
try:
body = body.encode('utf-8', 'surrogatepass')
body = body.encode('utf-8', 'surrogatepass')
except (UnicodeDecodeError, AttributeError):
# bytes/str - no need to re-encode
pass
@@ -311,6 +311,10 @@ class Transport(object):
connection = self.get_connection()
try:
# add a delay before attempting the next retry
# 0, 1, 3, 7, etc...
delay = 2**attempt - 1
time.sleep(delay)
status, headers_response, data = connection.perform_request(method, url, params, body, headers=headers, ignore=ignore, timeout=timeout)
except TransportError as e: