[rubygems/rubygems] Bump vendored net-http-persistent to 4.0.2
https://github.com/rubygems/rubygems/commit/b0edf39083
This commit is contained in:
parent
d49a92d036
commit
41779fede0
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user