instance method after_discard

Ruby on Rails 7.2.3

Since v7.1.6

Available in: v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

after_discard(&blk)

A block to run when a job is about to be discarded for any reason.

Example
class WorkJob < ActiveJob::Base
  after_discard do |job, exception|
    ExceptionNotifier.report(exception)
  end

  ...

end

Parameters

blk block
Source
# File activejob/lib/active_job/exceptions.rb, line 124
      def after_discard(&blk)
        self.after_discard_procs += [blk]
      end

Defined in activejob/lib/active_job/exceptions.rb line 124 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveJob::Exceptions::ClassMethods

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close