Skip to content
Browse files

Fix issues with last merge in relation to jobs:work task

Need to use .new(options).start now
Worker::say needed to be moved into the proper scope
  • Loading branch information...
1 parent b9ebbb4 commit 0be1cfae2ae4f96fc5600d824a5c0f1e38b61b79 @tedkulp tedkulp committed
Showing with 14 additions and 14 deletions.
  1. +13 −13 lib/delayed/worker.rb
  2. +1 −1 tasks/jobs.rake
View
26 lib/delayed/worker.rb
@@ -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
View
2 tasks/jobs.rake
@@ -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.
Something went wrong with that request. Please try again.