Sha256: ef983faea0b0d24db914cbf10719422071afbf26ce4f24270ddb0174f3181acb

Contents?: true

Size: 752 Bytes

Versions: 3

Compression:

Stored size: 752 Bytes

Contents

module Beanstalker
  class DaemonizerHandler < Daemonizer::Handler
    def prepare(starter, &block)
      logger.info "Loading Rails"
      require File.join(Daemonizer.root, '/config/environment')
      require 'beanstalker/worker'
      logger.info "Rails loaded"
      super
    end
    
    def start
      $logger = logger
      $logger.info "Starting cycle"
      if option(:error_handler)
        Worker.custom_error_handler = option(:error_handler)
      end
      @worker = Worker.new(binding, 
                :tube => option(:tube), 
                :servers => option(:servers),
                :worker_id => worker_id, 
                :workers_count => workers_count)
      @worker.run
      $logger.info "Ending cycle"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
beanstalker-0.4.5 lib/beanstalker/daemonizer_handler.rb
beanstalker-0.4.4 lib/beanstalker/daemonizer_handler.rb
beanstalker-0.4.3 lib/beanstalker/daemonizer_handler.rb