summaryrefslogtreecommitdiff
path: root/lib/bundler/vendor
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2023-06-30 19:00:18 +0200
committergit <svn-admin@ruby-lang.org>2023-06-30 22:11:58 +0000
commit41779fede04d730f94690ddc9f2b36a4ff73ddb0 (patch)
tree9c29c7842f995a8dad8f9454dca847a3accaa4bc /lib/bundler/vendor
parentd49a92d036fb316757d7c4a12a2f9808875f35bf (diff)
[rubygems/rubygems] Bump vendored net-http-persistent to 4.0.2
https://github.com/rubygems/rubygems/commit/b0edf39083
Diffstat (limited to 'lib/bundler/vendor')
-rw-r--r--lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb2
-rw-r--r--lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb1
-rw-r--r--lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb30
3 files changed, 23 insertions, 10 deletions
diff --git a/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb
index a4e1c5a750..bd53ee757e 100644
--- a/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb
+++ b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb
@@ -174,7 +174,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
##
# The version of Bundler::Persistent::Net::HTTP::Persistent you are using
- VERSION = '4.0.1'
+ VERSION = '4.0.2'
##
# Error class for errors raised by Bundler::Persistent::Net::HTTP::Persistent. Various
diff --git a/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb
index a57a5d1352..40f61aacea 100644
--- a/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb
+++ b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb
@@ -25,6 +25,7 @@ class Bundler::Persistent::Net::HTTP::Persistent::Connection # :nodoc:
ensure
reset
end
+ alias_method :close, :finish
def reset
@last_use = Bundler::Persistent::Net::HTTP::Persistent::EPOCH
diff --git a/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb
index 9dfa6ffdb1..736027863c 100644
--- a/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb
+++ b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb
@@ -11,20 +11,32 @@ class Bundler::Persistent::Net::HTTP::Persistent::Pool < Bundler::ConnectionPool
end
def checkin net_http_args
- stack = Thread.current[@key][net_http_args] ||= []
+ if net_http_args.is_a?(Hash) && net_http_args.size == 1 && net_http_args[:force]
+ # Bundler::ConnectionPool 2.4+ calls `checkin(force: true)` after fork.
+ # When this happens, we should remove all connections from Thread.current
+ if stacks = Thread.current[@key]
+ stacks.each do |http_args, connections|
+ connections.each do |conn|
+ @available.push conn, connection_args: http_args
+ end
+ connections.clear
+ end
+ end
+ else
+ stack = Thread.current[@key][net_http_args] ||= []
- raise Bundler::ConnectionPool::Error, 'no connections are checked out' if
- stack.empty?
+ raise Bundler::ConnectionPool::Error, 'no connections are checked out' if
+ stack.empty?
- conn = stack.pop
+ conn = stack.pop
- if stack.empty?
- @available.push conn, connection_args: net_http_args
+ if stack.empty?
+ @available.push conn, connection_args: net_http_args
- Thread.current[@key].delete(net_http_args)
- Thread.current[@key] = nil if Thread.current[@key].empty?
+ Thread.current[@key].delete(net_http_args)
+ Thread.current[@key] = nil if Thread.current[@key].empty?
+ end
end
-
nil
end