class Backburner::Workers::Simple

Public Instance Methods

prepare() click to toggle source

Used to prepare job queues before processing jobs. Setup beanstalk tube_names and watch all specified tubes for jobs.

@raise [Beaneater::NotConnected] If beanstalk fails to connect. @example

@worker.prepare
# File lib/backburner/workers/simple.rb, line 11
      def prepare
        self.tube_names.map! { |name| expand_tube_name(name)  }.uniq!
        log_info "Working #{tube_names.size} queues: [ #{tube_names.join(', ')} ]"
#        self.connection.tubes.watch!(*self.tube_names)
      end
start() click to toggle source

Starts processing new jobs indefinitely. Primary way to consume and process jobs in specified tubes.

@example

@worker.start
# File lib/backburner/workers/simple.rb, line 23
def start
  prepare
  loop { work_one_job }
end