class ActiveRecord::ConnectionAdapters::ConnectionHandler

def flush_idle_connections!(role = ActiveRecord::Base.current_role)

See ConnectionPool#flush! for details.

Disconnects all currently idle connections.
def flush_idle_connections!(role = ActiveRecord::Base.current_role)
  connection_pool_list(role).each(&:flush!)
end