Sha256: 22d568d6216bc03ed7258c6860ed0d38f81474b0ea027b8526f0bfbee4ee0724

Contents?: true

Size: 559 Bytes

Versions: 2

Compression:

Stored size: 559 Bytes

Contents

namespace :qc_plus do
  desc "Start a new worker for the (default or $QUEUE) queue"
  task :work  => :environment do
    puts "Starting up worker for queue #{ENV['QUEUE']}"
    @worker = QueueClassicPlus::CustomWorker.new

    trap('INT') do
      $stderr.puts("Received INT. Shutting down.")
      if !@worker.running
        $stderr.puts("Worker has stopped running. Exit.")
        exit(1)
      end
      @worker.stop
    end

    trap('TERM') do
      $stderr.puts("Received Term. Shutting down.")
      @worker.stop
    end

    @worker.start
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
queue_classic_plus-1.0.0.alpha2 lib/queue_classic_plus/tasks/work.rake
queue_classic_plus-0.0.2 lib/queue_classic_plus/tasks/work.rake