Sha256: 7ba46bd81ed4b6dc3d34d7205a884e4b6c2845dbd2f5763e41f095da9053859d
Contents?: true
Size: 514 Bytes
Versions: 3
Compression:
Stored size: 514 Bytes
Contents
require 'octopus/load_balancing' # The round-robin load balancing of slaves belonging to the same shard. # It is a pool that contains slaves which queries are distributed to. module Octopus module LoadBalancing class RoundRobin def initialize(slaves_list) @slaves_list = slaves_list @slave_index = 0 end # Returns the next available slave in the pool def next @slaves_list[@slave_index = (@slave_index + 1) % @slaves_list.length] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ar-octopus-0.8.5 | lib/octopus/load_balancing/round_robin.rb |
ar-octopus-0.8.4 | lib/octopus/load_balancing/round_robin.rb |
ar-octopus-0.8.3 | lib/octopus/load_balancing/round_robin.rb |