Class: Katello::ApplicableHostQueue
- Inherits:
-
Object
- Object
- Katello::ApplicableHostQueue
- Defined in:
- app/services/katello/applicable_host_queue.rb
Class Method Summary collapse
- .batch_size ⇒ Object
- .pop_hosts(amount = self.batch_size) ⇒ Object
- .push_hosts(ids) ⇒ Object
- .queue_depth ⇒ Object
Class Method Details
.batch_size ⇒ Object
3 4 5 |
# File 'app/services/katello/applicable_host_queue.rb', line 3 def self.batch_size Setting["applicability_batch_size"] end |
.pop_hosts(amount = self.batch_size) ⇒ Object
15 16 17 18 19 |
# File 'app/services/katello/applicable_host_queue.rb', line 15 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 |
.push_hosts(ids) ⇒ Object
11 12 13 |
# File 'app/services/katello/applicable_host_queue.rb', line 11 def self.push_hosts(ids) HostQueueElement.import ids.map { |host_id| { host_id: host_id } }, validate: false end |
.queue_depth ⇒ Object
7 8 9 |
# File 'app/services/katello/applicable_host_queue.rb', line 7 def self.queue_depth ::Katello::HostQueueElement.all.size end |