right_support 2.6.11 → 2.6.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -111,17 +111,6 @@ module RightSupport::Net
111
111
  new(endpoints, options).request(&block)
112
112
  end
113
113
 
114
- def resolve(endpoints)
115
- resolved_endpoints = RightSupport::Net::DNS.resolve(endpoints)
116
- @resolved_at = Time.now.to_i
117
- logger.info("RequestBalancer: resolved #{endpoints.inspect} to #{resolved_endpoints.inspect}")
118
- resolved_endpoints
119
- end
120
-
121
- def need_resolve?
122
- @options[:resolve] && Time.now.to_i - @resolved_at > @options[:resolve]
123
- end
124
-
125
114
  # Constructor. Accepts a sequence of request endpoints which it shuffles randomly at
126
115
  # creation time; however, the ordering of the endpoints does not change thereafter
127
116
  # and the sequence is tried from the beginning for every request.
@@ -185,8 +174,10 @@ module RightSupport::Net
185
174
  @endpoints = endpoints
186
175
 
187
176
  if @options[:resolve]
188
- @resolved_at = 0
177
+ # Perform initial DNS resolution
178
+ resolve
189
179
  else
180
+ # Use endpoints as-is
190
181
  @policy.set_endpoints(@endpoints)
191
182
  end
192
183
  end
@@ -207,10 +198,7 @@ module RightSupport::Net
207
198
  def request
208
199
  raise ArgumentError, "Must call this method with a block" unless block_given?
209
200
 
210
- if need_resolve?
211
- @ips = self.resolve(@endpoints)
212
- @policy.set_endpoints(@ips)
213
- end
201
+ resolve if need_resolve?
214
202
 
215
203
  exceptions = {}
216
204
  result = nil
@@ -332,6 +320,18 @@ module RightSupport::Net
332
320
  end
333
321
  end
334
322
 
323
+ def resolve
324
+ resolved_endpoints = RightSupport::Net::DNS.resolve(@endpoints)
325
+ logger.info("RequestBalancer: resolved #{@endpoints.inspect} to #{resolved_endpoints.inspect}")
326
+ @ips = resolved_endpoints
327
+ @policy.set_endpoints(@ips)
328
+ @resolved_at = Time.now.to_i
329
+ end
330
+
331
+ def need_resolve?
332
+ @options[:resolve] && Time.now.to_i - @resolved_at > @options[:resolve]
333
+ end
334
+
335
335
  def test_policy_duck_type(object)
336
336
  [:next, :good, :bad].all? { |m| object.respond_to?(m) }
337
337
  end
@@ -7,8 +7,8 @@ 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.11'
11
- s.date = '2013-01-02'
10
+ s.version = '2.6.12'
11
+ s.date = '2013-01-03'
12
12
 
13
13
  s.authors = ['Tony Spataro', 'Sergey Sergyenko', 'Ryan Williamson', 'Lee Kirchhoff', 'Sergey Enin', 'Alexey Karpik', 'Scott Messier']
14
14
  s.email = 'support@rightscale.com'
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: 1
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 6
9
- - 11
10
- version: 2.6.11
9
+ - 12
10
+ version: 2.6.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tony Spataro
@@ -21,7 +21,7 @@ autorequire:
21
21
  bindir: bin
22
22
  cert_chain: []
23
23
 
24
- date: 2013-01-02 00:00:00 -08:00
24
+ date: 2013-01-03 00:00:00 -08:00
25
25
  default_executable:
26
26
  dependencies: []
27
27