Skip to content

Commit b65c358

Browse files
committed
Better retry configuration for jobs
1 parent f31662a commit b65c358

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

app/jobs/application_job.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class ApplicationJob < ActiveJob::Base
44

55
queue_as :default
66

7-
discard_on ActiveJob::DeserializationError do |job, error|
7+
retry_on ActiveJob::DeserializationError, attempts: 3 do |job, error|
88
ErrorReporting.warn(
99
"Skipping job because of ActiveJob::DeserializationError (#{error.message})",
1010
arguments: job.arguments

app/jobs/send_notification_job.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# frozen_string_literal: true
22
class SendNotificationJob < ApplicationJob
3+
retry_on Aws::SES::Errors::Throttling, wait: :polynomially_longer, attempts: 10
4+
35
def perform(event_key:, options:)
46
notifier_class = Notifier.notifier_class_for_event_key(event_key)
57
notifier = notifier_class.new(**options)

0 commit comments

Comments
 (0)