# Re-definitions are appended to existing tasks task :environment task :merb_env namespace :jobs do desc "Clear the delayed_job queue." task :clear => [:merb_env, :environment] do Delayed::Job.delete_all end desc "Start a delayed_job worker." task :work => [:merb_env, :environment] do worker_count = ENV['WORKER_COUNT'].to_i rescue 1 worker_count = 1 if worker_count < 1 Delayed::Worker.new(:min_priority => ENV['MIN_PRIORITY'], :max_priority => ENV['MAX_PRIORITY'], :worker_count => worker_count).start end end