add wait on delay (#794)
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user