Skip to content

Commit 3840c79

Browse files
nevansdefunkt
authored andcommitted
make shutdown? method, which plugins can override
1 parent 8f5ff34 commit 3840c79

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/resque/worker.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def work(interval = 5, &block)
108108
startup
109109

110110
loop do
111-
break if @shutdown
111+
break if shutdown?
112112

113113
if not @paused and job = reserve
114114
log "got: #{job.inspect}"
@@ -265,6 +265,11 @@ def shutdown!
265265
kill_child
266266
end
267267

268+
# Should this worker shutdown as soon as current job is finished?
269+
def shutdown?
270+
@shutdown
271+
end
272+
268273
# Kills the forked child immediately, without remorse. The job it
269274
# is processing will not be completed.
270275
def kill_child

0 commit comments

Comments
 (0)