Class: SolidQueue::Job
- Includes:
- Clearable, Executable, Recurrable
- Defined in:
- app/models/solid_queue/job.rb,
app/models/solid_queue/job/clearable.rb,
app/models/solid_queue/job/retryable.rb,
app/models/solid_queue/job/executable.rb,
app/models/solid_queue/job/recurrable.rb,
app/models/solid_queue/job/schedulable.rb,
app/models/solid_queue/job/concurrency_controls.rb
Defined Under Namespace
Modules: Clearable, ConcurrencyControls, Executable, Recurrable, Retryable, Schedulable Classes: EnqueueError
Class Method Summary collapse
Methods included from Executable
#discard, #dispatch, #dispatch_bypassing_concurrency_limits, #finished!, #finished?, #prepare_for_execution, #status
Methods inherited from Record
Class Method Details
.enqueue(active_job, scheduled_at: Time.current) ⇒ Object
28 29 30 31 32 33 34 |
# File 'app/models/solid_queue/job.rb', line 28 def enqueue(active_job, scheduled_at: Time.current) active_job.scheduled_at = scheduled_at create_from_active_job(active_job).tap do |enqueued_job| active_job.provider_job_id = enqueued_job.id end end |
.enqueue_all(active_jobs) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/solid_queue/job.rb', line 12 def enqueue_all(active_jobs) active_jobs_by_job_id = active_jobs.index_by(&:job_id) transaction do jobs = create_all_from_active_jobs(active_jobs) prepare_all_for_execution(jobs).tap do |enqueued_jobs| enqueued_jobs.each do |enqueued_job| active_jobs_by_job_id[enqueued_job.active_job_id].provider_job_id = enqueued_job.id active_jobs_by_job_id[enqueued_job.active_job_id].successfully_enqueued = true end end end active_jobs.count(&:successfully_enqueued?) end |