Skip to content

Commit

Permalink
Fix issues with last merge in relation to jobs:work task
Browse files Browse the repository at this point in the history
Need to use .new(options).start now
Worker::say needed to be moved into the proper scope
  • Loading branch information
Ted Kulp committed Nov 1, 2008
1 parent b9ebbb4 commit 0be1cfa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions lib/delayed/worker.rb
Expand Up @@ -14,31 +14,31 @@ def start
trap('TERM') { say 'Exiting...'; $exit = true }
trap('INT') { say 'Exiting...'; $exit = true }

loop do
result = nil
loop do
result = nil

realtime = Benchmark.realtime do
result = Delayed::Job.work_off
end
realtime = Benchmark.realtime do
result = Delayed::Job.work_off
end

count = result.sum

break if $exit

if count.zero?
if count.zero?
sleep(SLEEP)
else
say "#{count} jobs processed at %.4f j/s, %d failed ..." % [count / realtime, result.last]
say "#{count} jobs processed at %.4f j/s, %d failed ..." % [count / realtime, result.last]
end

break if $exit
end

def say(text)
puts text unless @quiet
RAILS_DEFAULT_LOGGER.info text
end

end

def say(text)
puts text unless @quiet
RAILS_DEFAULT_LOGGER.info text
end

end
end
2 changes: 1 addition & 1 deletion tasks/jobs.rake
Expand Up @@ -6,6 +6,6 @@ namespace :jobs do

desc "Start a delayed_job worker."
task :work => :environment do
Delayed::Worker.new.start(:min_priority => ENV['MIN_PRIORITY'], :max_priority => ENV['MAX_PRIORITY'])
Delayed::Worker.new(:min_priority => ENV['MIN_PRIORITY'], :max_priority => ENV['MAX_PRIORITY']).start
end
end

0 comments on commit 0be1cfa

Please sign in to comment.