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.
226 227 228 |
# File 'lib/sensu/socket.rb', line 226 def on_error @on_error end |
#on_success ⇒ Object
Returns the value of attribute on_success.
226 227 228 |
# File 'lib/sensu/socket.rb', line 226 def on_success @on_success end |
Instance Method Details
#connection_completed ⇒ Object
228 229 230 231 |
# File 'lib/sensu/socket.rb', line 228 def connection_completed @connected_at = Time.now.to_f @inactivity_timeout = comm_inactivity_timeout end |
#unbind ⇒ Object
233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/sensu/socket.rb', line 233 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 |