Sha256: 94fe6e213e92d9c0553836a5f2d2f1a02fe8a5c2b4e174a4d3b7c9766cc27062
Contents?: true
Size: 994 Bytes
Versions: 3
Compression:
Stored size: 994 Bytes
Contents
# require 'resque/tasks' # will give you the resque tasks namespace :resque do task :setup desc "Start a Resque worker" task :work => :setup do require 'resque' queues = (ENV['QUEUES'] || ENV['QUEUE']).to_s.split(',') begin worker = Resque::Worker.new(*queues) worker.verbose = ENV['LOGGING'] || ENV['VERBOSE'] worker.very_verbose = ENV['VVERBOSE'] rescue Resque::NoQueueError abort "set QUEUE env var, e.g. $ QUEUE=critical,high rake resque:work" end if ENV['PIDFILE'] File.open(ENV['PIDFILE'], 'w') { |f| f << Process.pid.to_s } end worker.log "Starting worker #{worker}" worker.work(ENV['INTERVAL'] || 5) # interval, will block end desc "Start multiple Resque workers. Should only be used in dev mode." task :workers do threads = [] ENV['COUNT'].to_i.times do threads << Thread.new do system "rake resque:work" end end threads.each { |thread| thread.join } end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
resque-1.13.0 | lib/resque/tasks.rb |
resque-igo-1.12.8 | lib/resque/tasks.rb |
resque-1.12.0 | lib/resque/tasks.rb |