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