right_support 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,7 +51,7 @@ module RightSupport::Net::Balancing
51
51
  end
52
52
 
53
53
  def next
54
- [ @endpoints[@counter % @endpoints.size], true ] unless @endpoints.empty?
54
+ [ @endpoints[@counter % @endpoints.size], false ] unless @endpoints.empty?
55
55
  end
56
56
 
57
57
  def good(endpoint, t0, t1)
@@ -160,8 +160,10 @@ module RightSupport::Net
160
160
  # Return the first non-nil value provided by the block.
161
161
  def request
162
162
  raise ArgumentError, "Must call this method with a block" unless block_given?
163
-
164
- @policy.set_endpoints(self.resolve(@endpoints)) if self.expired?
163
+ if self.expired?
164
+ @ips = self.resolve(@endpoints)
165
+ @policy.set_endpoints(@ips)
166
+ end
165
167
 
166
168
  exceptions = []
167
169
  result = nil
@@ -173,7 +175,7 @@ module RightSupport::Net
173
175
  break
174
176
  else
175
177
  do_retry = @options[:retry] || DEFAULT_RETRY_PROC
176
- do_retry = do_retry.call(@endpoints, n) if do_retry.respond_to?(:call)
178
+ do_retry = do_retry.call(@ips || @endpoints, n) if do_retry.respond_to?(:call)
177
179
  break if (do_retry.is_a?(Integer) && n >= do_retry) || [nil, false].include?(do_retry)
178
180
  end
179
181
 
@@ -217,7 +219,7 @@ module RightSupport::Net
217
219
  return result if complete
218
220
 
219
221
  exceptions = exceptions.map { |e| e.class.name }.uniq.join(', ')
220
- msg = "No available endpoints from #{@endpoints.inspect}! Exceptions: #{exceptions}"
222
+ msg = "No available endpoints from #{(@ips || @endpoints).inspect}! Exceptions: #{exceptions}"
221
223
  logger.error "RequestBalancer: #{msg}"
222
224
  raise NoResult, msg
223
225
  end
@@ -15,17 +15,17 @@ module RightSupport::Net
15
15
  module_function
16
16
 
17
17
  def expected_hostname
18
- @expected_hostname
18
+ Thread.current[:right_support_net_ssl_expected_hostname]
19
19
  end
20
20
 
21
21
  def with_expected_hostname(hostname, &block)
22
- @expected_hostname = hostname
22
+ Thread.current[:right_support_net_ssl_expected_hostname] = hostname
23
23
  block.call
24
24
  rescue Exception => e
25
- @expected_hostname = nil
25
+ Thread.current[:right_support_net_ssl_expected_hostname] = nil
26
26
  raise e
27
27
  ensure
28
- @expected_hostname = nil
28
+ Thread.current[:right_support_net_ssl_expected_hostname] = nil
29
29
  end
30
30
  end
31
31
  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 = '1.3.1'
10
+ s.version = '1.3.2'
11
11
  s.date = '2012-03-14'
12
12
 
13
13
  s.authors = ['Tony Spataro', 'Sergey Sergyenko', 'Ryan Williamson', 'Lee Kirchhoff']
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: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 1
10
- version: 1.3.1
9
+ - 2
10
+ version: 1.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tony Spataro