class Elasticsearch::Transport::Transport::Connections::Selector::RoundRobin

“Round-robin” selector strategy (default).

Public Instance Methods

select(options={}) click to toggle source

Returns the next connection from the collection, rotating them in round-robin fashion.

@return [Connections::Connection]

# File lib/elasticsearch/transport/transport/connections/selector.rb, line 51
def select(options={})
  # On Ruby 1.9, Array#rotate could be used instead
  @current = !defined?(@current) || @current.nil? ? 0 : @current+1
  @current = 0 if @current >= connections.size
  connections[@current]
end