Module: Workerholic::Job

Included in:
ActiveJob::QueueAdapters::WorkerholicAdapter::JobWrapper
Defined in:
lib/workerholic/job.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
# File 'lib/workerholic/job.rb', line 3

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

Instance Method Details

#perform_async(*args) ⇒ Object



19
20
21
22
23
# File 'lib/workerholic/job.rb', line 19

def perform_async(*args)
  serialized_job, queue_name = prepare_job_for_enqueueing(args)

  Queue.new(@queue_name || queue_name).enqueue(serialized_job)
end

#perform_delayed(*args) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/workerholic/job.rb', line 25

def perform_delayed(*args)
  execution_time = Time.now.to_f + verify_delay(args)
  serialized_job = prepare_job_for_enqueueing(args).first

  sorted_set = SortedSet.new
  sorted_set.add(serialized_job, execution_time)
end