diff --git a/lib/resque/worker.rb b/lib/resque/worker.rb index 9099e6cf2..6223e7582 100644 --- a/lib/resque/worker.rb +++ b/lib/resque/worker.rb @@ -29,6 +29,8 @@ class Worker attr_reader :worker_queues + attr_accessor :graceful_term + # Workers should be initialized with an array of string queue # names. The order is important: a Worker will check the first # queue given for a job. If none is found, it will check the @@ -360,7 +362,7 @@ def enable_gc_optimizations # USR2: Don't process any new jobs # CONT: Start processing jobs again after a USR2 def register_signal_handlers - trap('TERM') { shutdown! } + trap('TERM') { graceful_term ? shutdown : shutdown! } trap('INT') { shutdown! } begin