Sha256: ba4663dfd2acc88b67a92e39e6d4d9e794a4219c9b65064b972ff0940ed09a93

Contents?: true

Size: 825 Bytes

Versions: 2

Compression:

Stored size: 825 Bytes

Contents

require 'active_support/concern'

module ActiveBeaneater
  module QueueOptions
    extend ::ActiveSupport::Concern

    module ClassMethods

      def queue_priority(pri)
        self.queue_priority_number = case pri
        when Integer
          pri
        when :low
          10000
        when :high
          0
        else
          fails ArgumentError, 'unknown priority'
        end
      end

      def queue_timeout_after(timeout)
        self.queue_respond_timeout = timeout
      end

    end

    included do
      # Beaneater native job, this is required for touch for long running jobs
      attr_accessor :native_job

      class_attribute :queue_priority_number
      class_attribute :queue_respond_timeout

      self.queue_priority_number = 0
      self.queue_respond_timeout = 1.minute
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_beaneater-0.1.1 lib/active_beaneater/queue_options.rb
active_beaneater-0.1.0 lib/active_beaneater/queue_options.rb