Skip to content

Commit

Permalink
move @Paused into a #paused? method
Browse files Browse the repository at this point in the history
  • Loading branch information
will committed May 5, 2011
1 parent 491d16d commit 4a13ceb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/resque/worker.rb
Expand Up @@ -116,7 +116,7 @@ def work(interval = 5.0, &block)
loop do
break if shutdown?

if not @paused and job = reserve
if not paused? and job = reserve
log "got: #{job.inspect}"
run_hook :before_fork, job
working_on job
Expand All @@ -136,7 +136,7 @@ def work(interval = 5.0, &block)
else
break if interval.zero?
log! "Sleeping for #{interval} seconds"
procline @paused ? "Paused" : "Waiting for #{@queues.join(',')}"
procline paused? ? "Paused" : "Waiting for #{@queues.join(',')}"
sleep interval
end
end
Expand Down Expand Up @@ -298,6 +298,11 @@ def kill_child
end
end

# are we paused?
def paused?
@paused
end

# Stop processing jobs after the current one has completed (if we're
# currently running one).
def pause_processing
Expand Down

0 comments on commit 4a13ceb

Please sign in to comment.