Sha256: 7f9c7ffbc5b1ed98f6dff80a332ffdf8b06558c188a1a8cfeed92861671283b2

Contents?: true

Size: 592 Bytes

Versions: 1

Compression:

Stored size: 592 Bytes

Contents

require 'resque/fifo/queue'

task "resque:fifo-worker" => :environment do
  prefix = ENV['PREFIX'] || 'fifo'
  worker = Resque::Plugins::Fifo::Worker.new
  worker.prepare
  worker.log "Starting worker #{self}"
  worker.work(ENV['INTERVAL'] || 5) # interval, will block
end

task "resque:fifo-workers" => :environment do
  threads = []

  if ENV['COUNT'].to_i < 1
    abort "set COUNT env var, e.g. $ COUNT=2 rake resque:workers"
  end

  ENV['COUNT'].to_i.times do
    threads << Thread.new do
      system "rake resque:fifo-worker"
    end
  end

  threads.each { |thread| thread.join }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
resque-fifo-queue-0.1.1 lib/resque/fifo/tasks.rb