2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-10-18 07:10:26 +02:00
|
|
|
class PriorizedMailDeliveryJob < ActionMailer::MailDeliveryJob
|
2024-03-29 11:33:57 +01:00
|
|
|
discard_on ActiveJob::DeserializationError
|
|
|
|
|
2023-10-18 07:10:26 +02:00
|
|
|
def queue_name
|
|
|
|
mailer, action_name = @arguments
|
|
|
|
if mailer.constantize.critical_email?(action_name)
|
|
|
|
super
|
|
|
|
else
|
|
|
|
custom_queue
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def custom_queue
|
2024-05-30 10:24:52 +02:00
|
|
|
ENV.fetch('BULK_EMAIL_QUEUE') { Rails.application.config.action_mailer.deliver_later_queue_name.to_s }
|
2023-10-18 07:10:26 +02:00
|
|
|
end
|
|
|
|
end
|