Fix broken pool drainer after the upgrade.
See 6cd5cc375a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb (L467)
We think there is a leak at the moment because a discarded pool
belonging to the parent process shouldn't be present in the
forked process.
This commit is contained in:
parent
f5ad0022f7
commit
29c1f01494
|
@ -26,13 +26,15 @@ class ActiveRecord::ConnectionAdapters::ConnectionPool
|
|||
# if idle_time is specified only connections idle for N seconds will be drained
|
||||
def drain(idle_time = nil, max_age = nil)
|
||||
synchronize do
|
||||
@available.clear
|
||||
@connections.delete_if do |conn|
|
||||
try_drain?(conn, idle_time, max_age)
|
||||
end
|
||||
if @available && @connections
|
||||
@available.clear
|
||||
@connections.delete_if do |conn|
|
||||
try_drain?(conn, idle_time, max_age)
|
||||
end
|
||||
|
||||
@connections.each do |conn|
|
||||
@available.add conn if !conn.in_use?
|
||||
@connections.each do |conn|
|
||||
@available.add conn if !conn.in_use?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue