Sha256: 3fd28432d4e4defeb1f6d13ed0eb9069f8e57f076ad7a2e089b57ee643e6ebe5

Contents?: true

Size: 490 Bytes

Versions: 4

Compression:

Stored size: 490 Bytes

Contents

# -*- encoding: utf-8 -*-

# A round-robin client pool. Clients are processed sequentially, and once
# all clients have been processed, the pool cycles back to the beginning.
class OnStomp::Failover::Pools::RoundRobin < OnStomp::Failover::Pools::Base
  def initialize uris, options = {}
    super
    @index = -1
  end

  # Returns the next sequential client in the pool
  # @return [OnStomp::Client]
  def next_client
    @index = (@index + 1) % clients.size
    clients[@index]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
onstomp-1.0.12 lib/onstomp/failover/pools/round_robin.rb
onstomp-1.0.11 lib/onstomp/failover/pools/round_robin.rb
onstomp-1.0.10 lib/onstomp/failover/pools/round_robin.rb
onstomp-1.0.9 lib/onstomp/failover/pools/round_robin.rb