lib/async/http/client.rb in async-http-0.64.2 vs lib/async/http/client.rb in async-http-0.65.0
- old
+ new
@@ -1,13 +1,12 @@
# frozen_string_literal: true
# Released under the MIT License.
-# Copyright, 2017-2023, by Samuel Williams.
+# Copyright, 2017-2024, by Samuel Williams.
# Copyright, 2022, by Ian Ker-Seymer.
-require 'async/io/endpoint'
-require 'async/io/stream'
+require 'io/endpoint'
require 'async/pool/controller'
require 'protocol/http/body/completable'
require 'protocol/http/methods'
@@ -105,11 +104,10 @@
response = make_response(request, connection)
# This signals that the ensure block below should not try to release the connection, because it's bound into the response which will be returned:
connection = nil
-
return response
rescue Protocol::RequestFailed
# This is a specific case where the entire request wasn't sent before a failure occurred. So, we can even resend non-idempotent requests.
if connection
@pool.release(connection)
@@ -131,10 +129,12 @@
retry
else
raise
end
ensure
- @pool.release(connection) if connection
+ if connection
+ @pool.release(connection)
+ end
end
end
def inspect
"#<#{self.class} authority=#{@authority.inspect}>"