Sha256: 5160a06e17eae692dd8e0b33d63986b3523ce57559c2cc23e53e33f2a94ef150

Contents?: true

Size: 756 Bytes

Versions: 9

Compression:

Stored size: 756 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

module AcidicJob
  module Extensions
    module ActionMailer
      extend ActiveSupport::Concern

      def deliver_acidicly(_options = {})
        job = ::ActionMailer::MailDeliveryJob

        job_args = [@mailer_class.name, @action.to_s, "deliver_now", @params, *@args]
        # for Sidekiq, this depends on the Sidekiq::Serialization extension
        serialized_job = job.new(job_args).serialize

        AcidicJob::Run.create!(
          staged: true,
          job_class: job.name,
          serialized_job: serialized_job,
          idempotency_key: IdempotencyKey.value_for(serialized_job)
        )
      end
      alias deliver_transactionally deliver_acidicly
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
acidic_job-1.0.0.pre9 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre8 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre7 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre6 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre5 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre4 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre3 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre2 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre1 lib/acidic_job/extensions/action_mailer.rb