Class: Sensu::SocketHandler
- Inherits:
-
EM::Connection
- Object
- EM::Connection
- Sensu::SocketHandler
- Defined in:
- lib/sensu/socket.rb
Instance Attribute Summary collapse
-
#on_error ⇒ Object
Returns the value of attribute on_error.
-
#on_success ⇒ Object
Returns the value of attribute on_success.
Instance Method Summary collapse
Instance Attribute Details
#on_error ⇒ Object
Returns the value of attribute on_error.
59 60 61 |
# File 'lib/sensu/socket.rb', line 59 def on_error @on_error end |
#on_success ⇒ Object
Returns the value of attribute on_success.
59 60 61 |
# File 'lib/sensu/socket.rb', line 59 def on_success @on_success end |
Instance Method Details
#connection_completed ⇒ Object
61 62 63 64 |
# File 'lib/sensu/socket.rb', line 61 def connection_completed @connected_at = Time.now.to_f @inactivity_timeout = comm_inactivity_timeout end |
#unbind ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/sensu/socket.rb', line 66 def unbind if @connected_at elapsed_time = Time.now.to_f - @connected_at if elapsed_time >= @inactivity_timeout @on_error.call('socket inactivity timeout') else @on_success.call('wrote to socket') end else @on_error.call('failed to connect to socket') end end |