Sha256: 7b5c402adc8588c8f9bdd8a2b1fc4d13d311f715830cba041c3a1e471991b810

Contents?: true

Size: 476 Bytes

Versions: 9

Compression:

Stored size: 476 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
    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

9 entries across 9 versions & 1 rubygems

Version Path
onstomp-1.0.8 lib/onstomp/failover/pools/round_robin.rb
onstomp-1.0.7 lib/onstomp/failover/pools/round_robin.rb
onstomp-1.0.6 lib/onstomp/failover/pools/round_robin.rb
onstomp-1.0.5 lib/onstomp/failover/pools/round_robin.rb
onstomp-1.0.4 lib/onstomp/failover/pools/round_robin.rb
onstomp-1.0.3 lib/onstomp/failover/pools/round_robin.rb
onstomp-1.0.2 lib/onstomp/failover/pools/round_robin.rb
onstomp-1.0.1 lib/onstomp/failover/pools/round_robin.rb
onstomp-1.0.0 lib/onstomp/failover/pools/round_robin.rb