Skip to content

Commit

Permalink
Merge pull request #972 from thecartercenter/12506_fix_deleted_form_r…
Browse files Browse the repository at this point in the history
…ender

12506: discard jobs on ActiveJob::DeserializationError
  • Loading branch information
cooperka authored Dec 14, 2023
2 parents a2725f2 + 1adbcdf commit ac3e1c1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/jobs/application_job.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# frozen_string_literal: true

# https://api.rubyonrails.org/classes/ActiveJob/Exceptions/ClassMethods.html
class ApplicationJob < ActiveJob::Base
include Rails.application.routes.url_helpers

around_perform do |_job, block|
Setting.with_cache(&block)
end

# Skip the job if the subject of the job has already been destroyed.
discard_on ActiveJob::DeserializationError do |job, error|
Rails.logger.error("Skipping #{job.class}: #{error.message}")
Sentry.add_breadcrumb(Sentry::Breadcrumb.new(message: error.message))
Sentry.capture_message("#{job.class} DeserializationError")
end
end

0 comments on commit ac3e1c1

Please sign in to comment.