def refresh(nodes_to_refresh = seeds)
      refreshed_nodes = []
      seen = {}
      # Set up a recursive lambda function for refreshing a node and it's peers.
      refresh_node = ->(node) do
        unless node.address.resolved
          begin
            node.refresh
          rescue Errors::ConnectionFailure
          end
        end
        unless seen[node] || !node.address.resolved
          seen[node] = true
          # Add the node to the global list of known nodes.
          seeds.push(node) unless seeds.include?(node)
          begin
            node.refresh
            # This node is good, so add it to the list of nodes to return.
            refreshed_nodes.push(node) unless refreshed_nodes.include?(node)
            # Now refresh any newly discovered peer nodes - this will also
            # remove nodes that are not included in the peer list.
            refresh_peers(node, &refresh_node)
          rescue Errors::ConnectionFailure
            # We couldn't connect to the node.
          end
        end
      end

      nodes_to_refresh.each(&refresh_node)
      refreshed_nodes
    end
def refresh(nodes_to_refresh = seeds)
      refreshed_nodes = []
      seen = {}
      # Set up a recursive lambda function for refreshing a node and it's peers.
      refresh_node = ->(node) do
        unless node.address.resolved
          begin
            node.refresh
          rescue Errors::ConnectionFailure
          end
        end
        unless seen[node] || !node.address.resolved
          seen[node] = true
          # Add the node to the global list of known nodes.
          seeds.push(node) unless seeds.include?(node)
          begin
            node.refresh
            # This node is good, so add it to the list of nodes to return.
            refreshed_nodes.push(node) unless refreshed_nodes.include?(node)
            # Now refresh any newly discovered peer nodes - this will also
            # remove nodes that are not included in the peer list.
            refresh_peers(node, &refresh_node)
          rescue Errors::ConnectionFailure
            # We couldn't connect to the node.
          end
        end
      end

      nodes_to_refresh.each(&refresh_node)
      refreshed_nodes
    end
Refreshes information for each of the nodes provided. The node list
 defaults to the list of all known nodes.

 If a node is successfully refreshed, any newly discovered peers will also
 be refreshed.

 @example Refresh the nodes.
   cluster.refresh

 @param [ Array<Node> ] nodes_to_refresh The nodes to refresh.

 @return [ Array<Node> ] the available nodes

 @since 1.0.0