Class: Elasticsearch::Transport::Transport::Connections::Selector::RoundRobin
- Inherits:
-
Object
- Object
- Elasticsearch::Transport::Transport::Connections::Selector::RoundRobin
- Includes:
- Base
- Defined in:
- lib/elasticsearch/transport/transport/connections/selector.rb
Overview
“Round-robin” selector strategy (default).
Instance Attribute Summary
Attributes included from Base
Instance Method Summary collapse
-
#select(options = {}) ⇒ Connections::Connection
Returns the next connection from the collection, rotating them in round-robin fashion.
Methods included from Base
Instance Method Details
#select(options = {}) ⇒ Connections::Connection
Returns the next connection from the collection, rotating them in round-robin fashion.
51 52 53 54 55 56 |
# File 'lib/elasticsearch/transport/transport/connections/selector.rb', line 51 def select(={}) # On Ruby 1.9, Array#rotate could be used instead @current = @current.nil? ? 0 : @current+1 @current = 0 if @current >= connections.size connections[@current] end |