sensu 0.11.0.beta.3 → 0.11.0.beta.4

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.md CHANGED
@@ -24,9 +24,6 @@ from log events and keepalives, eg. "client": { "redact": [
24
24
  You can configure the Sensu client socket (UDP & TCP), bind & port, eg.
25
25
  "client": { "socket": { "bind": "0.0.0.0", "port": 4040 } }.
26
26
 
27
- You can choose to reconnect to RabbitMQ on initial TCP connection
28
- failure, eg. "rabbitmq": { "on_failure": "reconnect" }.
29
-
30
27
  Handlers & mutators can now have a timeout, in seconds.
31
28
 
32
29
  ### Other
@@ -51,6 +48,9 @@ backlog, stale data that may overwhelm the recovering consumers.
51
48
 
52
49
  Improved Sensu client socket check validation.
53
50
 
51
+ AMQP connection will time out if the vhost is missing, there is a lack
52
+ of permissions, or authentication fails.
53
+
54
54
  ## 0.10.2 - 2013-07-18
55
55
 
56
56
  ### Other
@@ -1,6 +1,6 @@
1
1
  module Sensu
2
2
  unless defined?(Sensu::VERSION)
3
- VERSION = '0.11.0.beta.3'
3
+ VERSION = '0.11.0.beta.4'
4
4
 
5
5
  LOG_LEVELS = [:debug, :info, :warn, :error, :fatal]
6
6
 
@@ -47,26 +47,28 @@ module Sensu
47
47
  end
48
48
 
49
49
  def connect(options={})
50
+ timeout = EM::Timer.new(10) do
51
+ error = RabbitMQError.new('timed out while attempting to connect')
52
+ @on_error.call(error)
53
+ end
50
54
  on_failure = Proc.new do
51
- error = RabbitMQError.new('cannot connect to rabbitmq')
55
+ error = RabbitMQError.new('failed to connect')
52
56
  @on_error.call(error)
53
57
  end
58
+ @connection = AMQP.connect(options, {
59
+ :on_tcp_connection_failure => on_failure,
60
+ :on_possible_authentication_failure => on_failure
61
+ })
62
+ @connection.logger = Logger.get
63
+ @connection.on_open do
64
+ timeout.cancel
65
+ end
54
66
  reconnect = Proc.new do
55
67
  unless @connection.reconnecting?
56
68
  @before_reconnect.call
57
69
  @connection.periodically_reconnect(5)
58
70
  end
59
71
  end
60
- if options.is_a?(Hash)
61
- if options[:on_failure] == 'reconnect'
62
- on_failure = reconnect
63
- end
64
- end
65
- @connection = AMQP.connect(options, {
66
- :on_tcp_connection_failure => on_failure,
67
- :on_possible_authentication_failure => on_failure
68
- })
69
- @connection.logger = Logger.get
70
72
  @connection.on_tcp_connection_loss(&reconnect)
71
73
  @connection.on_skipped_heartbeats(&reconnect)
72
74
  @channel = AMQP::Channel.new(@connection)
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1103939663
4
+ hash: 346800981
5
5
  prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 11
9
9
  - 0
10
10
  - beta
11
- - 3
12
- version: 0.11.0.beta.3
11
+ - 4
12
+ version: 0.11.0.beta.4
13
13
  platform: ruby
14
14
  authors:
15
15
  - Sean Porter
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2013-09-20 00:00:00 -07:00
21
+ date: 2013-09-30 00:00:00 -07:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency