class ActiveRecord::ConnectionAdapters::ConnectionHandler

def active_connections?(role = ActiveRecord::Base.current_role)

pools that the ConnectionHandler is managing.
Returns true if there are any active connections among the connection
def active_connections?(role = ActiveRecord::Base.current_role)
  connection_pool_list(role).any?(&:active_connection?)
end