From 969339bd0ec2161af3c0830a9008d32a07c59b8b Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Sun, 27 Nov 2016 16:45:01 +1030 Subject: Clear available connections immediately It'll be re-cleared when it's rebuilt in with_new_connections_blocked's ensure, but we still need to clear it inside this synchronize -- we've disconnected connections that may be available in the queue, and while other threads are not allowed to make *new* connections, they are still allowed to take existing ones from there. This was incorrectly removed in d314646c965b045724e6bdb9d61dcecfabc0ba8f. --- .../lib/active_record/connection_adapters/abstract/connection_pool.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index d17722adec..5ec2fc073e 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -422,6 +422,7 @@ module ActiveRecord conn.disconnect! end @connections = [] + @available.clear end end end @@ -454,6 +455,7 @@ module ActiveRecord conn.disconnect! if conn.requires_reloading? end @connections.delete_if(&:requires_reloading?) + @available.clear end end end -- cgit v1.2.3