Class: Que::ChildJob

Inherits:
Job
  • Object
show all
Defined in:
lib/child_job.rb

Class Method Summary collapse

Methods included from BackgroundJobLogger

#_run

Methods included from SetApplicationNameWhenJobRuns

#_run, #get_application_name_when_job_runs, #set_application_name_when_job_runs

Class Method Details

.enqueue(*args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/child_job.rb', line 3

def self.enqueue(*args)
  Que.transaction do
    job_data = super

    parent_job_id = args.first[:parent_job_id] rescue nil
    if parent_job_id.present?
      QueJob.where(job_id: job_data.attrs['job_id']).update_all(parent_job_id: parent_job_id)
    end

    job_data
  end
end