lib/flapjack/jabber.rb in flapjack-0.6.26 vs lib/flapjack/jabber.rb in flapjack-0.6.27
- old
+ new
@@ -17,10 +17,11 @@
require 'yajl/json_gem'
require 'flapjack/data/entity_check'
require 'flapjack/pikelet'
require 'flapjack/utility'
+require 'flapjack/version'
module Flapjack
class Jabber < Blather::Client
@@ -160,12 +161,13 @@
msg += " identify \n"
msg += " help \n"
when command =~ /^identify$/
t = Process.times
-
- msg = "Flapjack process #{Process.pid} on #{`hostname -f`.chomp} \n"
+ boot_time = Time.at(@redis_handler.get('boot_time').to_i)
+ msg = "Flapjack #{Flapjack::VERSION} process #{Process.pid} on #{`hostname -f`.chomp} \n"
+ msg += "Boot time: #{boot_time}\n"
msg += "User CPU Time: #{t.utime}\n"
msg += "System CPU Time: #{t.stime}\n"
msg += `uname -a`.chomp + "\n"
when command =~ /^(.*)/
@@ -273,12 +275,14 @@
event = Yajl::Parser.parse(events[queue][1])
type = event['notification_type']
logger.debug('jabber notification event received')
logger.debug(event.inspect)
if 'shutdown'.eql?(type)
- EM.next_tick do
- # get delays without the next_tick
- close # Blather::Client.close
+ if should_quit?
+ EM.next_tick do
+ # get delays without the next_tick
+ close # Blather::Client.close
+ end
end
# FIXME: should we also set something so should_quit? returns true
# to prevent retrieving more notifications from the queue while closing?
# or does close only return once the connection is really and truely closed?
else