lib/httpx/plugins/retries.rb in httpx-0.9.0 vs lib/httpx/plugins/retries.rb in httpx-0.10.0
- old
+ new
@@ -73,17 +73,18 @@
(
response.is_a?(ErrorResponse) && __retryable_error?(response.error)
)
# rubocop:enable Style/MultilineTernaryOperator
)
-
+ response.close if response.respond_to?(:close)
request.retries -= 1
log { "failed to get response, #{request.retries} tries to go..." }
request.transition(:idle)
retry_after = options.retry_after
+ retry_after = retry_after.call(request, response) if retry_after.respond_to?(:call)
+
if retry_after
- retry_after = retry_after.call(request) if retry_after.respond_to?(:call)
log { "retrying after #{retry_after} secs..." }
pool.after(retry_after) do
log { "retrying!!" }
connection = find_connection(request, connections, options)