forked from openstreetmap/openstreetmap-website
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Discard jobs that fail to deserialize
- Loading branch information
Showing
3 changed files
with
13 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
class ApplicationJob < ActiveJob::Base | ||
# Automatically retry jobs that encountered a deadlock | ||
# retry_on ActiveRecord::Deadlocked | ||
|
||
# Most jobs are safe to ignore if the underlying records are no longer available | ||
# discard_on ActiveJob::DeserializationError | ||
def perform_now(*) | ||
super | ||
rescue ActiveJob::DeserializationError => e | ||
raise unless e.cause.is_a?(ActiveRecord::RecordNotFound) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class MailDeliveryJob < ActionMailer::MailDeliveryJob | ||
def perform_now(*) | ||
super | ||
rescue ActiveJob::DeserializationError => e | ||
raise unless e.cause.is_a?(ActiveRecord::RecordNotFound) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
class ApplicationMailer < ActionMailer::Base | ||
self.delivery_job = ActionMailer::MailDeliveryJob | ||
self.delivery_job = MailDeliveryJob | ||
end |