Sha256: 01f1842797cdca53c819c11e534ff31a70f1f0ff833c32f31e9bfbe86d8efca5

Contents?: true

Size: 925 Bytes

Versions: 18

Compression:

Stored size: 925 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

module AcidicJob
  module Extensions
    module ActionMailer
      extend ActiveSupport::Concern

      def deliver_acidicly(_options = {})
        job_class = ::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_class.new(job_args).serialize
        acidic_identifier = job_class.respond_to?(:acidic_identifier) ? job_class.acidic_identifier : :job_id
        key = IdempotencyKey.new(acidic_identifier).value_for(serialized_job)

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

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
acidic_job-1.0.0.pre29 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre28 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre27 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre26 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre25 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre24 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre23 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre22 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre21 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre20 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre19 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre18 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre17 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre16 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre15 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre14 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre13 lib/acidic_job/extensions/action_mailer.rb
acidic_job-1.0.0.pre12 lib/acidic_job/extensions/action_mailer.rb