Class: AMQP::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/sensu/transport/patches/amqp.rb

Instance Method Summary collapse

Instance Method Details

#send_heartbeatObject



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/sensu/transport/patches/amqp.rb', line 3

def send_heartbeat
  if tcp_connection_established? && !reconnecting? && !closed?
    send_frame(AMQ::Protocol::HeartbeatFrame)
    if !@handling_skipped_heartbeats && @last_server_heartbeat
      if @last_server_heartbeat < (Time.now - (self.heartbeat_interval * 2))
        logger.error("[amqp] Detected missing amqp heartbeats")
        self.handle_skipped_heartbeats
      end
    end
  end
end