Sha256: 9d98e7a926ebc6dcc14848591761747d4daf319eb5f2cbc7a10e8ff381230fd8

Contents?: true

Size: 614 Bytes

Versions: 29

Compression:

Stored size: 614 Bytes

Contents

module Katello
  class ApplicableHostQueue
    def self.batch_size
      ::Setting::Content.find_by(name: "applicability_batch_size").value
    end

    def self.queue_depth
      ::Katello::HostQueueElement.all.size
    end

    def self.push_hosts(ids)
      HostQueueElement.import ids.map { |host_id| { host_id: host_id } }, validate: false
    end

    def self.pop_hosts(amount = self.batch_size)
      queue = HostQueueElement.group(:host_id).select("MIN(created_at) as created_at, host_id").limit(amount)
      HostQueueElement.where(host_id: queue.map(&:host_id)).delete_all
      queue
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
katello-4.2.0.1.rc3 app/services/katello/applicable_host_queue.rb
katello-4.2.0.1.rc2 app/services/katello/applicable_host_queue.rb
katello-4.2.0.rc2 app/services/katello/applicable_host_queue.rb
katello-4.1.3 app/services/katello/applicable_host_queue.rb
katello-4.2.0.rc1 app/services/katello/applicable_host_queue.rb
katello-4.1.2.1 app/services/katello/applicable_host_queue.rb
katello-4.1.2 app/services/katello/applicable_host_queue.rb
katello-4.1.1 app/services/katello/applicable_host_queue.rb
katello-4.1.0 app/services/katello/applicable_host_queue.rb