Sha256: 6b1fd9f0207846882634d6b2f08509be3586334589224bd0ff6e5ffb953af57c

Contents?: true

Size: 859 Bytes

Versions: 28

Compression:

Stored size: 859 Bytes

Contents

module Backburner
  module Workers
    class Simple < Worker
      # 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
      #
      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

      # Starts processing new jobs indefinitely.
      # Primary way to consume and process jobs in specified tubes.
      #
      # @example
      #   @worker.start
      #
      def start
        prepare
        loop { work_one_job }
      end
    end # Basic
  end # Workers
end # Backburner

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
backburner-allq-1.0.26 lib/backburner/workers/simple.rb
backburner-allq-1.0.25 lib/backburner/workers/simple.rb
backburner-allq-1.0.24 lib/backburner/workers/simple.rb
backburner-allq-1.0.23 lib/backburner/workers/simple.rb
backburner-allq-1.0.22 lib/backburner/workers/simple.rb
backburner-allq-1.0.21 lib/backburner/workers/simple.rb
backburner-allq-1.0.20 lib/backburner/workers/simple.rb
backburner-allq-1.0.19 lib/backburner/workers/simple.rb