Skip to content

Commit 4a13ceb

Browse files
committed
move @Paused into a #paused? method
1 parent 491d16d commit 4a13ceb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/resque/worker.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def work(interval = 5.0, &block)
116116
loop do
117117
break if shutdown?
118118

119-
if not @paused and job = reserve
119+
if not paused? and job = reserve
120120
log "got: #{job.inspect}"
121121
run_hook :before_fork, job
122122
working_on job
@@ -136,7 +136,7 @@ def work(interval = 5.0, &block)
136136
else
137137
break if interval.zero?
138138
log! "Sleeping for #{interval} seconds"
139-
procline @paused ? "Paused" : "Waiting for #{@queues.join(',')}"
139+
procline paused? ? "Paused" : "Waiting for #{@queues.join(',')}"
140140
sleep interval
141141
end
142142
end
@@ -298,6 +298,11 @@ def kill_child
298298
end
299299
end
300300

301+
# are we paused?
302+
def paused?
303+
@paused
304+
end
305+
301306
# Stop processing jobs after the current one has completed (if we're
302307
# currently running one).
303308
def pause_processing

0 commit comments

Comments
 (0)