beetle 0.2.1 → 0.2.2

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.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "beetle"
3
- s.version = "0.2.1"
3
+ s.version = "0.2.2"
4
4
 
5
5
  s.required_rubygems_version = ">= 1.3.1"
6
6
  s.authors = ["Stefan Kaes", "Pascal Friederich", "Ali Jelveh", "Sebastian Roebke"]
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
31
31
  s.specification_version = 3
32
32
  s.add_runtime_dependency("uuid4r", [">= 0.1.1"])
33
33
  s.add_runtime_dependency("bunny", [">= 0.6.0"])
34
- s.add_runtime_dependency("redis", [">= 2.0.3"])
34
+ s.add_runtime_dependency("redis", [">= 2.0.4"])
35
35
  s.add_runtime_dependency("amqp", [">= 0.6.7"])
36
36
  s.add_runtime_dependency("activesupport", [">= 2.3.4"])
37
37
  s.add_runtime_dependency("daemons", [">= 1.0.10"])
@@ -54,4 +54,5 @@ module Beetle
54
54
  end
55
55
  end
56
56
 
57
+ Timer = RUBY_VERSION < "1.9" ? SystemTimer : Timeout
57
58
  end
@@ -279,7 +279,7 @@ module Beetle
279
279
  end
280
280
 
281
281
  def run_handler(handler)
282
- Redis::Timer.timeout(@timeout.to_f) { @handler_result = handler.call(self) }
282
+ Timer.timeout(@timeout.to_f) { @handler_result = handler.call(self) }
283
283
  RC::OK
284
284
  rescue Exception => @exception
285
285
  Beetle::reraise_expectation_errors!
@@ -51,29 +51,3 @@ class Redis #:nodoc:
51
51
  info["role"] == "slave" && info["master_host"] == host && info["master_port"] == port.to_s
52
52
  end
53
53
  end
54
-
55
- class Redis::Client #:nodoc:
56
- protected
57
- def connect_to(host, port)
58
- if @timeout != 0 and Redis::Timer
59
- begin
60
- Redis::Timer.timeout(@timeout){ @sock = TCPSocket.new(host, port) }
61
- rescue Timeout::Error
62
- @sock = nil
63
- raise Timeout::Error, "Timeout connecting to the server"
64
- end
65
- else
66
- @sock = TCPSocket.new(host, port)
67
- end
68
-
69
- @sock.setsockopt Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1
70
-
71
- # If the timeout is set we set the low level socket options in order
72
- # to make sure a blocking read will return after the specified number
73
- # of seconds. This hack is from memcached ruby client.
74
- self.timeout = @timeout
75
-
76
- rescue Errno::ECONNREFUSED
77
- raise Errno::ECONNREFUSED, "Unable to connect to Redis on #{host}:#{port}"
78
- end
79
- end
@@ -56,15 +56,9 @@ module Beetle
56
56
  end
57
57
 
58
58
  class RedisTimeoutTest < Test::Unit::TestCase
59
- test "should use Redis::Timer if timeout is greater 0" do
59
+ test "should use a timer" do
60
60
  r = Redis.new(:host => "localhost", :port => 6390, :timeout => 1)
61
- Redis::Timer.expects(:timeout).with(1).raises(Timeout::Error)
62
- assert_equal({}, r.info_with_rescue)
63
- end
64
-
65
- test "should not use Redis::Timer if timeout 0" do
66
- r = Redis.new(:host => "localhost", :port => 6390, :timeout => 0)
67
- Redis::Timer.expects(:timeout).never
61
+ r.client.expects(:with_timeout).with(1).raises(Timeout::Error)
68
62
  assert_equal({}, r.info_with_rescue)
69
63
  end
70
64
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beetle
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Stefan Kaes
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-07-22 00:00:00 +02:00
21
+ date: 2010-07-26 00:00:00 +02:00
22
22
  default_executable: beetle
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
@@ -61,12 +61,12 @@ dependencies:
61
61
  requirements:
62
62
  - - ">="
63
63
  - !ruby/object:Gem::Version
64
- hash: 9
64
+ hash: 7
65
65
  segments:
66
66
  - 2
67
67
  - 0
68
- - 3
69
- version: 2.0.3
68
+ - 4
69
+ version: 2.0.4
70
70
  type: :runtime
71
71
  version_requirements: *id003
72
72
  - !ruby/object:Gem::Dependency