daemon-kit 0.1.7.8 → 0.1.7.9
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/History.txt +5 -0
- data/daemon_generators/amqp/templates/libexec/daemon.rb +8 -0
- data/lib/daemon_kit.rb +1 -1
- data/lib/daemon_kit/initializer.rb +6 -3
- metadata +1 -1
data/History.txt
CHANGED
@@ -22,6 +22,14 @@ DaemonKit::AMQP.run do
|
|
22
22
|
# amqp gem. Any code in the examples (from the gem) would work just
|
23
23
|
# fine here.
|
24
24
|
|
25
|
+
# Uncomment this for connection keep-alive
|
26
|
+
# AMQP.conn.connection_status do |status|
|
27
|
+
# DaemonKit.logger.debug("AMQP connection status changed: #{status}")
|
28
|
+
# if status == :disconnected
|
29
|
+
# AMQP.conn.reconnect(true)
|
30
|
+
# end
|
31
|
+
# end
|
32
|
+
|
25
33
|
amq = ::MQ.new
|
26
34
|
amq.queue('test').subscribe do |msg|
|
27
35
|
DaemonKit.logger.debug "Received message: #{msg.inspect}"
|
data/lib/daemon_kit.rb
CHANGED
@@ -9,7 +9,7 @@ $:.unshift( File.dirname(__FILE__).to_absolute_path ) unless
|
|
9
9
|
$:.include?( File.dirname(__FILE__).to_absolute_path )
|
10
10
|
|
11
11
|
module DaemonKit
|
12
|
-
VERSION = '0.1.7.
|
12
|
+
VERSION = '0.1.7.9'
|
13
13
|
|
14
14
|
autoload :Initializer, 'daemon_kit/initializer'
|
15
15
|
autoload :Application, 'daemon_kit/application'
|
@@ -60,10 +60,13 @@ module DaemonKit
|
|
60
60
|
initializer.after_daemonize
|
61
61
|
end
|
62
62
|
|
63
|
-
def self.shutdown
|
63
|
+
def self.shutdown( clean = false )
|
64
|
+
return unless $daemon_kit_shutdown_hooks_ran.nil?
|
65
|
+
$daemon_kit_shutdown_hooks_ran = true
|
66
|
+
|
64
67
|
DaemonKit.logger.info "Running shutdown hooks"
|
65
68
|
|
66
|
-
log_exceptions if DaemonKit.configuration.backtraces
|
69
|
+
log_exceptions if DaemonKit.configuration.backtraces && !clean
|
67
70
|
|
68
71
|
DaemonKit.logger.warn "Shutting down #{DaemonKit.configuration.daemon_name}"
|
69
72
|
exit
|
@@ -162,7 +165,7 @@ module DaemonKit
|
|
162
165
|
end
|
163
166
|
|
164
167
|
def initialize_signal_traps
|
165
|
-
term_proc = Proc.new { DaemonKit::Initializer.shutdown }
|
168
|
+
term_proc = Proc.new { DaemonKit::Initializer.shutdown( true ) }
|
166
169
|
configuration.trap( 'INT', term_proc )
|
167
170
|
configuration.trap( 'TERM', term_proc )
|
168
171
|
at_exit { DaemonKit::Initializer.shutdown }
|