Sha256: f5c5a45c334e2515fff60cc1366f1a55387af145c1d87063e8b0fcc70cd32c12

Contents?: true

Size: 743 Bytes

Versions: 2

Compression:

Stored size: 743 Bytes

Contents

module Resque
  class Ranger
    include Raemon::Worker
  
    def start
      logger.info "=> Starting worker #{Process.pid}"
    end
  
    def stop
      logger.info "=> Stopping worker #{Process.pid}"
    
      EM.stop_event_loop if EM.reactor_running?
    end
  
    def run
      queues = Choice.choices[:queue].to_s.split(',')
      
      begin
        worker = Runner.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

      puts "*** Starting worker #{worker}"

      worker.work(ENV['INTERVAL'] || 5) # interval, will block
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
resque-ranger-0.1.2 lib/resque/ranger.rb
resque-ranger-0.1.1 lib/resque/ranger.rb