Class: SolidQueue::ScheduledExecution

Inherits:
Execution
  • Object
show all
Includes:
Dispatching
Defined in:
app/models/solid_queue/scheduled_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

.dispatch_next_batch(batch_size) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'app/models/solid_queue/scheduled_execution.rb', line 14

def dispatch_next_batch(batch_size)
  transaction do
    job_ids = next_batch(batch_size).non_blocking_lock.pluck(:job_id)
    if job_ids.empty? then []
    else
      SolidQueue.instrument(:dispatch_scheduled, batch_size: batch_size) do |payload|
        payload[:size] = dispatch_jobs(job_ids)
      end
    end
  end
end