Module: Maitredee::ActiveJob

Extended by:
ActiveJob
Included in:
ActiveJob
Defined in:
lib/maitredee/active_job.rb

Instance Method Summary collapse

Instance Method Details

#call_later(*args) ⇒ Object

Uses ActiveJob to async the publishing

Examples:

To configure the specific async job open PublisherJob

class RecipePublisher < Maitredee::Publisher
  class PublisherJob
    queue_as :low
  end
end

RecipePublisher.call_later(Recipe.find(1))


28
29
30
# File 'lib/maitredee/active_job.rb', line 28

def call_later(*args)
  self::PublisherJob.perform_later(*args)
end

#call_later_at(at, *args) ⇒ Object

Like call_later, but performs at a given time

Examples:

Configuring a time to perform the job

RecipePublisher.call_later_at(Date.tomorrow.noon, Recipe.find(1))


36
37
38
# File 'lib/maitredee/active_job.rb', line 36

def call_later_at(at, *args)
  self::PublisherJob.set(wait_until: at).perform_later(*args)
end