thrift_client 0.4.4 → 0.4.5

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.
data/CHANGELOG CHANGED
@@ -1,10 +1,12 @@
1
- v0.4.4 Default to 0 retries rather than the number of servers.
1
+ v0.4.5. Fix broken retries.
2
2
 
3
- v0.4.3 Bug fixes: handle_exception could be called more than once. Integer types are read signed.
3
+ v0.4.4. Default to 0 retries rather than the number of servers.
4
4
 
5
- v0.4.2 Allow per-method overrides of retries. Fix several bugs with EventMachine.
5
+ v0.4.3. Bug fixes: handle_exception could be called more than once. Integer types are read signed.
6
6
 
7
- v0.4.1 Making ThriftClient decoratable. Able to add new functionality a class definition.
7
+ v0.4.2. Allow per-method overrides of retries. Fix several bugs with EventMachine.
8
+
9
+ v0.4.1. Making ThriftClient decoratable. Able to add new functionality a class definition.
8
10
 
9
11
  v0.4.0. Add new EventMachine transport. This requires two layers of transport
10
12
  configurability:
data/Manifest CHANGED
@@ -21,3 +21,4 @@ test/simple_test.rb
21
21
  test/test_helper.rb
22
22
  test/thrift_client_http_test.rb
23
23
  test/thrift_client_test.rb
24
+ thrift_client.gemspec
@@ -153,7 +153,7 @@ class AbstractThriftClient
153
153
  disconnect_on_error!
154
154
  tries ||= (@options[:retry_overrides][method_name.to_sym] || @retries) + 1
155
155
  tries -= 1
156
- tries >= 0 ? raise : retry
156
+ tries > 0 ? retry : raise
157
157
  end
158
158
 
159
159
  def send_rpc(method_name, *args)
@@ -59,6 +59,25 @@ class ThriftClientTest < Test::Unit::TestCase
59
59
  assert_equal 1, times_called
60
60
  end
61
61
 
62
+ def test_retries_correct_number_of_times
63
+ stub_server(@socket) do |socket|
64
+ opts = @options.merge(:timeout => @timeout, :retries => 4, :server_retry_period => nil)
65
+ client = ThriftClient.new(Greeter::Client, "127.0.0.1:#{@socket}", opts)
66
+ times_called = 0
67
+
68
+ singleton_class = (class << client; self end)
69
+
70
+ # disconnect_on_error! is called every time a server related
71
+ # connection error happens. it will be called every try (so, retries + 1)
72
+ singleton_class.send :define_method, :disconnect_on_error! do |*args|
73
+ times_called += 1; super
74
+ end
75
+
76
+ assert_raises(Thrift::TransportException) { client.greeting("someone") }
77
+ assert_equal opts[:retries] + 1, times_called
78
+ end
79
+ end
80
+
62
81
  def test_dont_raise_with_defaults
63
82
  client = ThriftClient.new(Greeter::Client, @servers.first, @options.merge(:raise => false, :defaults => {:greeting => 1}))
64
83
  assert_equal 1, client.greeting
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{thrift_client}
5
- s.version = "0.4.4"
5
+ s.version = "0.4.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0.8") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Evan Weaver"]
9
- s.date = %q{2010-07-23}
9
+ s.date = %q{2010-07-28}
10
10
  s.description = %q{A Thrift client wrapper that encapsulates some common failover behavior.}
11
11
  s.email = %q{}
12
12
  s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.rdoc", "lib/thrift_client.rb", "lib/thrift_client/abstract_thrift_client.rb", "lib/thrift_client/connection.rb", "lib/thrift_client/connection/base.rb", "lib/thrift_client/connection/factory.rb", "lib/thrift_client/connection/http.rb", "lib/thrift_client/connection/socket.rb", "lib/thrift_client/event_machine.rb", "lib/thrift_client/simple.rb", "lib/thrift_client/thrift.rb"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thrift_client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 4
10
- version: 0.4.4
9
+ - 5
10
+ version: 0.4.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Evan Weaver
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-23 00:00:00 -07:00
18
+ date: 2010-07-28 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency