thrift_client 0.6.0 → 0.6.1

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,3 +1,5 @@
1
+ v0.6.1 Add connect timeout. Bump thrift dependency to ~> v0.6.0.
2
+
1
3
  v0.6.0 Fix bug where we'd try to mark the current server down when we didn't have a current server.
2
4
  Upgrade to thrift 0.5.
3
5
 
data/Rakefile CHANGED
@@ -7,10 +7,8 @@ Echoe.new("thrift_client") do |p|
7
7
  p.project = "fauna"
8
8
  p.summary = "A Thrift client wrapper that encapsulates some common failover behavior."
9
9
  p.rubygems_version = ">= 0.8"
10
- p.dependencies = ['thrift ~>0.5.0']
10
+ p.dependencies = ['thrift ~>0.6.0']
11
11
  p.ignore_pattern = /^(vendor\/thrift)/
12
12
  p.rdoc_pattern = /^(lib|bin|tasks|ext)|^README|^CHANGELOG|^TODO|^LICENSE|^COPYING$/
13
- p.url = "http://blog.evanweaver.com/files/doc/fauna/thrift_client/"
14
- p.docs_host = "blog.evanweaver.com:~/www/bax/public/files/doc/"
15
13
  p.spec_pattern = "spec/*_spec.rb"
16
14
  end
@@ -38,6 +38,7 @@ class AbstractThriftClient
38
38
  :server_max_requests => nil,
39
39
  :retry_overrides => {},
40
40
  :wrapped_exception_classes => DEFAULT_WRAPPED_ERRORS,
41
+ :connect_timeout => 0.1,
41
42
  :timeout => 1,
42
43
  :timeout_overrides => {}
43
44
  }
@@ -78,7 +79,7 @@ class AbstractThriftClient
78
79
  # call.
79
80
  def connect!
80
81
  @current_server = next_live_server
81
- @connection = Connection::Factory.create(@options[:transport], @options[:transport_wrapper], @current_server.connection_string, @options[:timeout])
82
+ @connection = Connection::Factory.create(@options[:transport], @options[:transport_wrapper], @current_server.connection_string, @options[:connect_timeout])
82
83
  @connection.connect!
83
84
  @client = @client_class.new(@options[:protocol].new(@connection.transport, *@options[:protocol_extra_params]))
84
85
  end
@@ -91,12 +91,25 @@ class ThriftClientTest < Test::Unit::TestCase
91
91
  end
92
92
  end
93
93
 
94
+ def test_socket_timeout
95
+ stub_server(@port) do |socket|
96
+ measurement = Benchmark.measure do
97
+ assert_raises(Greeter::Client::TransportException) do
98
+ ThriftClient.new(Greeter::Client, "127.0.0.1:#{@port}",
99
+ @options.merge(:timeout => 1, :connect_timeout => 0.5)
100
+ ).greeting("someone")
101
+ end
102
+ end
103
+ assert(measurement.real > 0.5 && measurement.real < 1)
104
+ end
105
+ end
106
+
94
107
  def test_framed_transport_timeout
95
108
  stub_server(@port) do |socket|
96
109
  measurement = Benchmark.measure do
97
110
  assert_raises(Greeter::Client::TransportException) do
98
111
  ThriftClient.new(Greeter::Client, "127.0.0.1:#{@port}",
99
- @options.merge(:timeout => @timeout)
112
+ @options.merge(:timeout => @timeout, :connect_timeout => @timeout)
100
113
  ).greeting("someone")
101
114
  end
102
115
  end
@@ -108,7 +121,7 @@ class ThriftClientTest < Test::Unit::TestCase
108
121
  stub_server(@port) do |socket|
109
122
  measurement = Benchmark.measure do
110
123
  client = ThriftClient.new(Greeter::Client, "127.0.0.1:#{@port}",
111
- @options.merge(:timeout => @timeout, :transport_wrapper => Thrift::BufferedTransport)
124
+ @options.merge(:timeout => @timeout, :transport_wrapper => Thrift::BufferedTransport, :connect_timeout => @timeout)
112
125
  )
113
126
  assert_raises(Greeter::Client::TransportException) do
114
127
  client.greeting("someone")
@@ -2,33 +2,32 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{thrift_client}
5
- s.version = "0.6.0"
5
+ s.version = "0.6.1"
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, Ryan King, Jeff Hodges"]
9
- s.date = %q{2010-12-08}
9
+ s.date = %q{2011-05-09}
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"]
13
13
  s.files = ["CHANGELOG", "LICENSE", "Manifest", "README.rdoc", "Rakefile", "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", "test/greeter/greeter.rb", "test/greeter/greeter.thrift", "test/greeter/server.rb", "test/multiple_working_servers_test.rb", "test/simple_test.rb", "test/test_helper.rb", "test/thrift_client_http_test.rb", "test/thrift_client_test.rb", "thrift_client.gemspec"]
14
- s.homepage = %q{http://blog.evanweaver.com/files/doc/fauna/thrift_client/}
14
+ s.homepage = %q{http://fauna.github.com/fauna/thrift_client/}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Thrift_client", "--main", "README.rdoc"]
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = %q{fauna}
18
- s.rubygems_version = %q{1.3.7}
18
+ s.rubygems_version = %q{1.7.2}
19
19
  s.summary = %q{A Thrift client wrapper that encapsulates some common failover behavior.}
20
20
  s.test_files = ["test/multiple_working_servers_test.rb", "test/simple_test.rb", "test/test_helper.rb", "test/thrift_client_http_test.rb", "test/thrift_client_test.rb"]
21
21
 
22
22
  if s.respond_to? :specification_version then
23
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
23
  s.specification_version = 3
25
24
 
26
25
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
- s.add_runtime_dependency(%q<thrift>, ["~> 0.5.0"])
26
+ s.add_runtime_dependency(%q<thrift>, ["~> 0.6.0"])
28
27
  else
29
- s.add_dependency(%q<thrift>, ["~> 0.5.0"])
28
+ s.add_dependency(%q<thrift>, ["~> 0.6.0"])
30
29
  end
31
30
  else
32
- s.add_dependency(%q<thrift>, ["~> 0.5.0"])
31
+ s.add_dependency(%q<thrift>, ["~> 0.6.0"])
33
32
  end
34
33
  end
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
5
- prerelease: false
4
+ hash: 5
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 0
10
- version: 0.6.0
9
+ - 1
10
+ version: 0.6.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Evan Weaver, Ryan King, Jeff Hodges
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-08 00:00:00 -08:00
19
- default_executable:
18
+ date: 2011-05-09 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: thrift
@@ -26,12 +25,12 @@ dependencies:
26
25
  requirements:
27
26
  - - ~>
28
27
  - !ruby/object:Gem::Version
29
- hash: 11
28
+ hash: 7
30
29
  segments:
31
30
  - 0
32
- - 5
31
+ - 6
33
32
  - 0
34
- version: 0.5.0
33
+ version: 0.6.0
35
34
  type: :runtime
36
35
  version_requirements: *id001
37
36
  description: A Thrift client wrapper that encapsulates some common failover behavior.
@@ -79,8 +78,7 @@ files:
79
78
  - test/thrift_client_http_test.rb
80
79
  - test/thrift_client_test.rb
81
80
  - thrift_client.gemspec
82
- has_rdoc: true
83
- homepage: http://blog.evanweaver.com/files/doc/fauna/thrift_client/
81
+ homepage: http://fauna.github.com/fauna/thrift_client/
84
82
  licenses: []
85
83
 
86
84
  post_install_message:
@@ -115,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
113
  requirements: []
116
114
 
117
115
  rubyforge_project: fauna
118
- rubygems_version: 1.3.7
116
+ rubygems_version: 1.7.2
119
117
  signing_key:
120
118
  specification_version: 3
121
119
  summary: A Thrift client wrapper that encapsulates some common failover behavior.