Permalink
Browse files

make shutdown? method, which plugins can override

  • Loading branch information...
1 parent 8f5ff34 commit 3840c790c41a9a95096f71128697100d4e7dfb09 @nevans nevans committed with defunkt Jul 29, 2010
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/resque/worker.rb
View
@@ -108,7 +108,7 @@ def work(interval = 5, &block)
startup
loop do
- break if @shutdown
+ break if shutdown?
if not @paused and job = reserve
log "got: #{job.inspect}"
@@ -265,6 +265,11 @@ def 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

0 comments on commit 3840c79

Please sign in to comment.