Module: JobGroups

Defined in:
lib/delayed_job_groups/job_groups.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
# File 'lib/delayed_job_groups/job_groups.rb', line 3

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#enqueue(job) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/delayed_job_groups/job_groups.rb', line 21

def enqueue(job)
  payload = job.payload_object
  target = payload.class == ::Delayed::PerformableMethod ? payload.object : payload    
  if target.class.has_job_groups?
    job.lock_group = target.class.lock_group(target)
    job.save
  end
end