Sha256: 2e301a4a58a233643113efe84648626e39dc36322e3b12d8e394a9a52c5c22cb

Contents?: true

Size: 656 Bytes

Versions: 5

Compression:

Stored size: 656 Bytes

Contents

class CacheKeeper::BaseJob < ActiveJob::Base
  discard_on StandardError

  private

  # Monkey patch ActiveJob::Core#serialize_arguments to use our custom serializers
  # in case the `serializer` option is present. I'm doing it this way because I don't
  # want to register the serializer as it would affect the whole application.
  def serialize_arguments(arguments)
    arguments.map do |argument|
      ActiveJob::Arguments.send :serialize_argument, argument
    rescue ActiveJob::SerializationError => e
      if arguments.first.serialize_target?
        arguments.first.serialize_target argument
      else
        raise e
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cache_keeper-0.5.1 app/jobs/cache_keeper/base_job.rb
cache_keeper-0.5.0 app/jobs/cache_keeper/base_job.rb
cache_keeper-0.4.1 app/jobs/cache_keeper/base_job.rb
cache_keeper-0.4.0 app/jobs/cache_keeper/base_job.rb
cache_keeper-0.3.0 app/jobs/cache_keeper/base_job.rb