Question: Should jobs within jobs use perform_later or perform

Question

Should jobs within jobs use perform_later or perform

Answers 1
Added at 2016-12-12 21:12
Tags
Question

I'm calling ExampleJob.perform_later in an action. This job is in turn calling two other jobs (see below).

Should these as well have the method perform_later or perform or doesn't it matter?

class ExampleJob < ApplicationJob
  queue_as :default

  def perform(*args)
    Example2Job.perform_later
    Example3Job.perform_later
  end
end
Answers to

Should jobs within jobs use perform_later or perform

nr: #1 dodano: 2016-12-12 22:12

If you want your jobs to be performed asynchronously, you should use perform_later. Otherwise you can use Job.new.perform or Job.perform_now

Source Show
◀ Wstecz