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,6 +26,7 @@ class ActiveRecord::ConnectionAdapters::ConnectionPool
|
||||||
# if idle_time is specified only connections idle for N seconds will be drained
|
# if idle_time is specified only connections idle for N seconds will be drained
|
||||||
def drain(idle_time = nil, max_age = nil)
|
def drain(idle_time = nil, max_age = nil)
|
||||||
synchronize do
|
synchronize do
|
||||||
|
if @available && @connections
|
||||||
@available.clear
|
@available.clear
|
||||||
@connections.delete_if do |conn|
|
@connections.delete_if do |conn|
|
||||||
try_drain?(conn, idle_time, max_age)
|
try_drain?(conn, idle_time, max_age)
|
||||||
|
@ -35,6 +36,7 @@ class ActiveRecord::ConnectionAdapters::ConnectionPool
|
||||||
@available.add conn if !conn.in_use?
|
@available.add conn if !conn.in_use?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue