lib/resque/worker.rb in resque-1.9.10 vs lib/resque/worker.rb in resque-1.10.0
- old
+ new
@@ -106,11 +106,11 @@
def work(interval = 5, &block)
$0 = "resque: Starting"
startup
loop do
- break if @shutdown
+ break if shutdown?
if not @paused and job = reserve
log "got: #{job.inspect}"
run_hook :before_fork, job
working_on job
@@ -261,9 +261,14 @@
# Kill the child and shutdown immediately.
def shutdown!
shutdown
kill_child
+ end
+
+ # Should this worker shutdown as soon as current job is finished?
+ def shutdown?
+ @shutdown
end
# Kills the forked child immediately, without remorse. The job it
# is processing will not be completed.
def kill_child