Class: SolidQueue::ReadyExecution

Inherits:
Execution show all
Defined in:
app/models/solid_queue/ready_execution.rb

Class Method Summary collapse

Methods inherited from Execution

create_all_from_jobs, #discard, discard_all_from_jobs, discard_all_in_batches, execution_data_from_jobs, type, #type

Methods inherited from Record

non_blocking_lock

Class Method Details

.aggregated_count_across(queue_list) ⇒ Object



18
19
20
# File 'app/models/solid_queue/ready_execution.rb', line 18

def aggregated_count_across(queue_list)
  QueueSelector.new(queue_list, self).scoped_relations.map(&:count).sum
end

.claim(queue_list, limit, process_id) ⇒ Object



10
11
12
13
14
15
16
# File 'app/models/solid_queue/ready_execution.rb', line 10

def claim(queue_list, limit, process_id)
  QueueSelector.new(queue_list, self).scoped_relations.flat_map do |queue_relation|
    select_and_lock(queue_relation, process_id, limit).tap do |locked|
      limit -= locked.size
    end
  end
end