Method: Cuetip::Job.queue

Defined in:
lib/cuetip/job.rb

.queue(params = {}, &block) ⇒ Cuetip::Models::Job

Queue this job

Parameters:

  • (defaults to: {})

Returns:



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/cuetip/job.rb', line 54

def queue(params = {}, &block)
  # Create our new job
  job = Models::Job.new(class_name: name, params: params)
  # Copy over any class leve lconfig
  job.queue_name = queue_name
  job.maximum_execution_time = maximum_execution_time
  job.ttl = ttl
  job.retry_count = retry_count
  job.retry_interval = retry_interval
  job.delay_execution = delay_execution
  job.delete_after_execution = delete_after_execution
  # Call the block
  block.call(job) if block_given?
  # Create the job
  job.save!
  # Return the job
  job
end