garru-ruby_scribe_client 0.0.7 → 0.0.9

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.0.9 requiring timeout
2
+ v0.0.8 also adding timeout to socket open
1
3
  v0.0.7 adding timeout
2
4
  v0.0.6.1 fb303: added host option. moved client to module namespace
3
5
  v0.0.5 wrote fb303 client for scribe mgmt
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ruby_scribe_client}
5
- s.version = "0.0.7"
5
+ s.version = "0.0.9"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Gary Tsang"]
@@ -8,6 +8,7 @@
8
8
  #
9
9
  require 'thrift/transport'
10
10
  require 'socket'
11
+ require 'timeout'
11
12
 
12
13
  module Thrift
13
14
  class Socket < Transport
@@ -23,7 +24,11 @@ module Thrift
23
24
 
24
25
  def open
25
26
  begin
26
- @handle = TCPSocket.new(@host, @port)
27
+ status = Timeout::timeout(@timeout) {
28
+ @handle = TCPSocket.new(@host, @port)
29
+ }
30
+ rescue Timeout::Error
31
+ raise TransportException.new(TransportException::TIMED_OUT, "Could not connect to #{@desc}")
27
32
  rescue StandardError
28
33
  raise TransportException.new(TransportException::NOT_OPEN, "Could not connect to #{@desc}")
29
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: garru-ruby_scribe_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gary Tsang