Change terms of service e-mail job to be iterable (#35126)

This commit is contained in:
Eugen Rochko 2025-06-24 09:41:39 +02:00 committed by GitHub
commit 1be48d0cab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 49 additions and 16 deletions

View file

@ -0,0 +1,25 @@
# frozen_string_literal: true
module BulkMailer
def push_bulk_mailer(mailer_class, mailer_method, args_array)
raise ArgumentError, "No method #{mailer_method} on class #{mailer_class.name}" unless mailer_class.respond_to?(mailer_method)
job_class = ActionMailer::MailDeliveryJob
Sidekiq::Client.push_bulk({
'class' => ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper,
'wrapped' => job_class,
'queue' => mailer_class.deliver_later_queue_name,
'args' => args_array.map do |args|
[
job_class.new(
mailer_class.name,
mailer_method.to_s,
'deliver_now',
args: args
).serialize,
]
end,
})
end
end