Skip to content

Commit

Permalink
Merge pull request resque#276 from will/patch-1
Browse files Browse the repository at this point in the history
move @Paused into a #paused? method
  • Loading branch information
defunkt committed May 11, 2011
2 parents 491d16d + 4a13ceb commit 8f8449e
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 8f8449e

Please sign in to comment.