Sha256: 2a029426e4be2b668229bda730cdc70294111522117fa722ff662ea4a9cf21b3

Contents?: true

Size: 810 Bytes

Versions: 9

Compression:

Stored size: 810 Bytes

Contents

class CallbackJob < ActiveJob::Base
  include ActiveJob::Retry

  before_perform ->(job) { job.history << "CallbackJob ran before_perform" }
  after_perform ->(job) { job.history << "CallbackJob ran after_perform" }

  before_enqueue ->(job) { job.history << "CallbackJob ran before_enqueue" }
  after_enqueue ->(job) { job.history << "CallbackJob ran after_enqueue" }

  around_perform do |job, block|
    job.history << "CallbackJob ran around_perform_start"
    block.call
    job.history << "CallbackJob ran around_perform_stop"
  end

  around_enqueue do |job, block|
    job.history << "CallbackJob ran around_enqueue_start"
    block.call
    job.history << "CallbackJob ran around_enqueue_stop"
  end


  def perform(person = "david")
    # NOTHING!
  end

  def history
    @history ||= []
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
activejob-retry-0.5.1 test/jobs/callback_job.rb
activejob-retry-0.5.0 test/jobs/callback_job.rb
activejob-retry-0.4.2 test/jobs/callback_job.rb
activejob-retry-0.4.1 test/jobs/callback_job.rb
activejob-retry-0.4.0 test/jobs/callback_job.rb
activejob-retry-0.3.1 test/jobs/callback_job.rb
activejob-retry-0.3.0 test/jobs/callback_job.rb
activejob-retry-0.2.0 test/jobs/callback_job.rb
activejob-retry-0.1.1 test/jobs/callback_job.rb