lib/httpx/session.rb in httpx-1.2.1 vs lib/httpx/session.rb in httpx-1.2.2
- old
+ new
@@ -26,16 +26,18 @@
#
# session.wrap do |http|
# http.get("https://wikipedia.com")
# end # wikipedia connection closes here
def wrap
- begin
- prev_persistent = @persistent
- @persistent = true
- yield self
- ensure
- @persistent = prev_persistent
- close unless @persistent
+ prev_persistent = @persistent
+ @persistent = true
+ pool.wrap do
+ begin
+ yield self
+ ensure
+ @persistent = prev_persistent
+ close unless @persistent
+ end
end
end
# closes all the active connections from the session
def close(*args)