lib/baidubce/retry_policy.rb in baidubce-sdk-0.9.0 vs lib/baidubce/retry_policy.rb in baidubce-sdk-0.9.1
- old
+ new
@@ -66,10 +66,16 @@
# Only retry on a subset of service exceptions
if http_code == 408
logger.debug('Retry for request timeout.')
return true
end
+ # retry for SocketError
+ if http_code == SOCKET_ERROR_CODE
+ logger.debug('Retry for request SocketError.')
+ return true
+ end
+
if http_code >= 500 && http_code != 501
logger.debug('Retry for server error.')
return true
end
return false
@@ -80,8 +86,9 @@
return 0 if retries_attempted < 0
delay_in_millis = (1 << retries_attempted) * @base_interval_in_millis
return @max_delay_in_millis if delay_in_millis > @max_delay_in_millis
return delay_in_millis
end
+
end
end