Flowdock
method

discard_on

Importance_1
v5.1.7 - Show latest stable - 0 notes - Class: ClassMethods
discard_on(exception) public

Discard the job with no attempts to retry, if the exception is raised. This is useful when the subject of the job, like an Active Record, is no longer available, and the job is thus no longer relevant.

Example

class SearchIndexingJob < ActiveJob::Base
  discard_on ActiveJob::DeserializationError

  def perform(record)
    # Will raise ActiveJob::DeserializationError if the record can't be deserialized
  end
end
Show source
Register or log in to add new notes.