right_support 2.6.9 → 2.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -140,7 +140,7 @@ module RightSupport::Net::LB
140
140
  @stack.update!(endpoints)
141
141
  else
142
142
  @health_check = @options.delete(:health_check)
143
- @counter = rand(0xffff) % endpoints.size
143
+ @counter = Process.pid
144
144
  @last_size = endpoints.size
145
145
  @stack = EndpointsStack.new(self, endpoints, @options[:yellow_states], @options[:reset_time], @options[:on_health_change])
146
146
  end
@@ -152,9 +152,10 @@ module RightSupport::Net::LB
152
152
  endpoints = @stack.sweep_and_return_yellow_and_green
153
153
  return nil if endpoints.empty?
154
154
 
155
- # Selection of the next endpoint using RoundRobin
155
+ # From the available set, use a RoundRobin-like algorithm to select the next endpoint.
156
+ # When the size of the available set changes, try not to disturb our index into the list.
156
157
  @counter += 1 unless endpoints.size < @last_size
157
- @counter = 0 if @counter == endpoints.size
158
+ @counter %= endpoints.size
158
159
  @last_size = endpoints.size
159
160
 
160
161
  # Hash#select returns a Hash in ruby1.9, but an Array of pairs in ruby1.8.
@@ -196,7 +197,11 @@ module RightSupport::Net::LB
196
197
 
197
198
  # Proxy to EndpointStack
198
199
  def get_stats
199
- @stack.get_stats
200
+ if @stack
201
+ @stack.get_stats
202
+ else
203
+ {}
204
+ end
200
205
  end
201
206
 
202
207
  end
@@ -7,7 +7,7 @@ spec = Gem::Specification.new do |s|
7
7
  s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
8
8
 
9
9
  s.name = 'right_support'
10
- s.version = '2.6.9'
10
+ s.version = '2.6.10'
11
11
  s.date = '2013-01-01'
12
12
 
13
13
  s.authors = ['Tony Spataro', 'Sergey Sergyenko', 'Ryan Williamson', 'Lee Kirchhoff', 'Sergey Enin', 'Alexey Karpik', 'Scott Messier']
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_support
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 6
9
- - 9
10
- version: 2.6.9
9
+ - 10
10
+ version: 2.6.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tony Spataro